AstroHuntsman / huntsman-drp

Imaging pipeline tools and flow.
MIT License
0 stars 2 forks source link

Add lock to collection insert / delete / update methods #128

Closed danjampro closed 3 years ago

danjampro commented 3 years ago

These methods are not currently thread-safe e.g. because two documents that are inserted simultaneously may both satisfy the uniqueness criteria in collection.find() before actually getting inserted into the mongodb collection.

danjampro commented 3 years ago

Maybe a lock is not the best solution as this would require a server / client in addition to the existing mongodb. There maybe alternatives, e.g. using mongodb unique indices:

https://docs.mongodb.com/manual/core/index-unique/#std-label-index-type-unique