mosaic
mosaic copied to clipboard
API: creating an experiment and adding trees to an experiment aren't atomic
If there's a problem with one of the trees that's supposed to be created (in practice, usually an email address for a malicious expert that's not yet in the app), the trees will be created up until that tree, then the tree creation will error, leaving all of the trees created so far around
It would be good if either all of the trees were created, or none
(atomic as in: https://en.wikipedia.org/wiki/ACID#Atomicity)
BTW I thought I had created this issue a while ago, so may be a duplicate
Yeah good point would make sense to wrap in a transaction.
Agreed as well. @zjmiller do we have any examples of transactions with atomic guarantees in Mosaic?
No but in this case with everything limited to a single function body is should be fairly straightforward: https://sequelize.org/master/manual/transactions.html
For changing expert designations, https://github.com/oughtinc/mosaic/pull/701 now uses atomic transactions. I will save atomic transactions on bulkCreateExperiments for a separate PR so 701 doesn't get too large.