ensure save emits are executed before we return to the user#39
Open
jsullivanlive wants to merge 1 commit intoammmir:masterfrom
Open
ensure save emits are executed before we return to the user#39jsullivanlive wants to merge 1 commit intoammmir:masterfrom
jsullivanlive wants to merge 1 commit intoammmir:masterfrom
Conversation
race conditions can happen when the user uses this express app to generate a token and then tries to use the access_token before the save transaction was successful
Owner
|
that's true, but we're not passing a callback so calling each individual listener doesn't guarantee anything... unless what you do in the listener is synchronous and you throw an error. a test would be helpful to understand! i'm not against your fix, i just want to understand how it fixes an inherent design flaw in the code :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A race condition happens when the user uses this express app to generate a token and then tries to use the access_token before the save transaction was successful with another app. The response to the user was happening for me several milliseconds earlier, leaving enough time for a server to beat the token to the database.