illinois / queue

A microservice queue for holding open office hours
University of Illinois/NCSA Open Source License
82 stars 36 forks source link

Use transactions to fix socket update errors #262

Closed nwalters512 closed 5 years ago

nwalters512 commented 5 years ago

As noted in the Sequelize docs, Sequelize uses a transaction internally for operations like findOrCreate, which is precisely the method that the active staff API uses when adding staff members. I believe this fact is causing #92 - there's a race condition where we try to read a tuple before the transaction that creates it has been committed. This PR modifies the code from sequelize-stream to make the options object available to event listeners so that we can use options.transaction as appropriate.

Closes #92 (just over a year after it was reported!)

vercel[bot] commented 5 years ago

This pull request is automatically deployed with Now. To access deployments, click Details below or on the icon next to each push.

nwalters512 commented 5 years ago

Yep, good call!

Would also be nice to contribute these changes back to sequelize-stream someday, but I don't think I have the bandwidth to do that now.