You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And of course stalk.use does IO so node schedules before calling the callback, opening up an opportunity for a race condition if another request also calls stalk.use.
I imagine that's how a good number of people have their code structured. To prevent the race condition, we need to either call use & put sequentially without a potential schedule between them, or we need to use a different stalk connection per tube.
A use_and_put function would make the first easier for people, and also make the problem more obvious.
Regardless of solution, the README should probably warn people not to do what I did. :)
The text was updated successfully, but these errors were encountered:
We're starting to see jobs showing up in the wrong tube in production.
It appears to be a race condition. Our code looks like this:
And of course stalk.use does IO so node schedules before calling the callback, opening up an opportunity for a race condition if another request also calls stalk.use.
I imagine that's how a good number of people have their code structured. To prevent the race condition, we need to either call use & put sequentially without a potential schedule between them, or we need to use a different stalk connection per tube.
A use_and_put function would make the first easier for people, and also make the problem more obvious.
Regardless of solution, the README should probably warn people not to do what I did. :)
The text was updated successfully, but these errors were encountered: