Skip to content
This repository was archived by the owner on Apr 17, 2023. It is now read-only.

Commit b1c7c8a

Browse files
authored
Merge pull request #56 from feedhenry/race-condition
Fix to cope with race condition with multiple refs for one sync record
2 parents 8733af9 + 3ccb1c8 commit b1c7c8a

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

lib/storage/dataset-clients.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ function upsertOrDeleteDatasetRecords(datasetId, datasetClientId, records, cb) {
154154
} else if (op === 'delete') {
155155
//remove the ref
156156
update['$pull'] = {'refs': datasetClientId};
157+
// also set the hash to null to handle race condition when multiple refs associated with single record
158+
update['$set']['hash'] = null;
157159
}
158160
datasetRecordsCol.findOneAndUpdate({uid: record.uid}, update, {upsert: true, returnOriginal: false}, function(err, updated) {
159161
if (err) {

0 commit comments

Comments
 (0)