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
The extension normally should prohibit this. They most likely hit the submit button twice, but this means we have a race condition. Specifically, the following:
hasBeenSubmitted <- does user have active request?
(intermediate logic)
if hasBeenSubmitted then show error that user has already submitted request
else store request
The race condition is between the two. Ideally this should be done as a transaction to avoid this problem. This may require some significant refactoring since currently the way this is designed, each database operation is designed to be atomic. The way I am thinking to do this is make the database driver an argument to each of the database interaction functions (ones that do writes will require a writeable database instance). Then we can create a function for starting and committing a transaction. So it would be something like this:
db <- get writeable database and begin transaction
hasBeenSubmitted <- does user have active request? (determine using db)
(intermediate logic)
if hasBeenSubmitted then show error that user has already been submitted request
else store request (using db)
commit transaction for db
release db
The text was updated successfully, but these errors were encountered:
The extension normally should prohibit this. They most likely hit the submit button twice, but this means we have a race condition. Specifically, the following:
The race condition is between the two. Ideally this should be done as a transaction to avoid this problem. This may require some significant refactoring since currently the way this is designed, each database operation is designed to be atomic. The way I am thinking to do this is make the database driver an argument to each of the database interaction functions (ones that do writes will require a writeable database instance). Then we can create a function for starting and committing a transaction. So it would be something like this:
The text was updated successfully, but these errors were encountered: