Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 5fb8950

Browse files
Update ES updates to wait for index to refresh before returning with response
1 parent 8942530 commit 5fb8950

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/common/helper.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ async function updateUser (userId, body) {
8989
index: config.get('ES.USER_INDEX'),
9090
type: config.get('ES.USER_TYPE'),
9191
id: userId,
92-
body: { doc: body }
92+
body: { doc: body },
93+
refresh: 'wait_for'
9394
})
9495
}
9596

@@ -114,7 +115,8 @@ async function updateOrg (organizationId, body) {
114115
index: config.get('ES.ORGANIZATION_INDEX'),
115116
type: config.get('ES.ORGANIZATION_TYPE'),
116117
id: organizationId,
117-
body: { doc: body }
118+
body: { doc: body },
119+
refresh: 'wait_for'
118120
})
119121
}
120122

src/services/ProcessorService.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ async function processCreate (message) {
2727
type: topResources[resource].type,
2828
id: message.payload.id,
2929
body: _.omit(message.payload, 'resource'),
30-
refresh: 'true'
30+
refresh: 'wait_for'
3131
})
3232
} else if (_.includes(_.keys(userResources), resource)) {
3333
// process user resources such as userSkill, userAttribute...
@@ -102,7 +102,8 @@ async function processUpdate (message) {
102102
id,
103103
body: {
104104
doc: _.assign(source, _.omit(message.payload, 'resource'))
105-
}
105+
},
106+
refresh: 'wait_for'
106107
})
107108
} else if (_.includes(_.keys(userResources), resource)) {
108109
// process user resources such as userSkill, userAttribute...
@@ -174,7 +175,7 @@ async function processDelete (message) {
174175
index: topResources[resource].index,
175176
type: topResources[resource].type,
176177
id: message.payload.id,
177-
refresh: 'true'
178+
refresh: 'wait_for'
178179
})
179180
} else if (_.includes(_.keys(userResources), resource)) {
180181
// process user resources such as userSkill, userAttribute...

0 commit comments

Comments
 (0)