Skip to content

Commit f51bb08

Browse files
committed
fix: use transactionId when get data from ES
1 parent 9417170 commit f51bb08

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/services/WorkPeriodProcessorService.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ async function processCreate (message, transactionId) {
2020
// Find related resourceBooking
2121
const resourceBooking = await esClient.getExtra({
2222
index: config.get('esConfig.ES_INDEX_RESOURCE_BOOKING'),
23+
transactionId,
2324
id: workPeriod.resourceBookingId
2425
})
2526
console.log(`[RB value-999] before update: ${JSON.stringify(resourceBooking)}`)
@@ -76,6 +77,7 @@ async function processUpdate (message, transactionId) {
7677
// find workPeriod in it's parent ResourceBooking
7778
let resourceBooking = await esClient.search({
7879
index: config.get('esConfig.ES_INDEX_RESOURCE_BOOKING'),
80+
transactionId,
7981
body: {
8082
query: {
8183
nested: {
@@ -106,11 +108,12 @@ async function processUpdate (message, transactionId) {
106108
body: {
107109
doc: { workPeriods }
108110
},
109-
refresh: constants.esRefreshOption
111+
refresh: 'true'
110112
})
111113
// find workPeriod's new parent ResourceBooking
112114
resourceBooking = await esClient.getExtra({
113115
index: config.get('esConfig.ES_INDEX_RESOURCE_BOOKING'),
116+
transactionId,
114117
id: data.resourceBookingId
115118
})
116119
// Get ResourceBooking's existing workPeriods
@@ -127,7 +130,7 @@ async function processUpdate (message, transactionId) {
127130
body: {
128131
doc: { workPeriods }
129132
},
130-
refresh: constants.esRefreshOption
133+
refresh: 'true'
131134
})
132135
return
133136
}
@@ -162,6 +165,7 @@ async function processDelete (message, transactionId) {
162165
// Find related ResourceBooking
163166
const resourceBooking = await esClient.search({
164167
index: config.get('esConfig.ES_INDEX_RESOURCE_BOOKING'),
168+
transactionId,
165169
body: {
166170
query: {
167171
nested: {

0 commit comments

Comments
 (0)