Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use transactions to fix socket update errors #262

Merged
merged 3 commits into from
Apr 7, 2019

Conversation

nwalters512
Copy link
Contributor

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
Copy link

vercel bot commented Apr 7, 2019

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

Copy link
Member

@james9909 james9909 left a comment

Choose a reason for hiding this comment

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

Since we're adding our own modified version of sequelize-stream, can we remove it as a dependency?

@vercel vercel bot temporarily deployed to staging April 7, 2019 22:12 Inactive
@nwalters512
Copy link
Contributor Author

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.

@nwalters512 nwalters512 merged commit 8cc541e into master Apr 7, 2019
@nwalters512 nwalters512 deleted the fix-socket-active-staff-errors branch April 7, 2019 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants