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

Race condition improved #57

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Race condition improved #57

wants to merge 2 commits into from

Conversation

wtrocki
Copy link
Member

@wtrocki wtrocki commented Dec 19, 2019

More refined version of the fix that was applied.
Refinement based on the problem from #48

@@ -154,8 +154,10 @@ function upsertOrDeleteDatasetRecords(datasetId, datasetClientId, records, cb) {
} else if (op === 'delete') {
//remove the ref
update['$pull'] = {'refs': datasetClientId};
// also set the hash to null to handle race condition when multiple refs associated with single record
update['$set']['hash'] = null;
if(datasetClientId && datasetClientId.length !==0){
Copy link
Member Author

@wtrocki wtrocki Dec 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this is still quite bad. Technically we should be

A) Removing an item if there is no other ref
B) Removing just ref if there are other refs

Not sure if that is not going to cause and side issues

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants