-
Notifications
You must be signed in to change notification settings - Fork 11
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
[MI-3629] Added cluster mutexes and solved the problem of race conditions for whitelist #351
Conversation
…lowed through a whitelist Created a new config setting called connectedUsersAllowed Added validation on this config setting that its value should be greater than or equal to the no. of connected users already present in the DB Added the logic to validate this in the OnActivate function Created several store functions for different usecases Modified the connect command handler to check for whitelist Added the logic to store the user in whitelist in the oAuth redirect API handler
Fixed a bug in the OAuth flow regarding storing the user in whitelist Added the whitelist logic in the connect bot command Added unit tests for connect and connect bot slash command Added unit tests for the store functions
…s-sync into MI-3606
…itelist size when updating the config value Changed the help text and name of the config variable Removed the function of getting count of connected users from the store
…s-sync into MI-3606
…itions for whitelist Created store functions for locking and unlocking the whitelist Modified the store fuctions to use transactions for accessing the whitelist Created new functions for processing and validating the configuration and used them everywhere Fixed an existing bug in the needsConnect API Added the logic of locking and accessing the whitelist in the complete OAuth API Added the logic of reverting the OAuth if there's an error in accessing the whitelist
Changed error message in the OAuth API handler Used constants in the store file for table names
…eams-sync into MI-3629
…eams-sync into MI-3629
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix ci
Changed definition of a function to take the transaction as the first parameter Modified the validation of the configuration variables Fixed the data race in the store test functions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good to me.
…ed the commit transaction and unlock whitelist flow in OAuth redirect handler
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm hesitant to see something like LOCK TABLE
used outside of exceptional scenarios. Is there a problem description of what race conditions we're trying to solve?
@lieut-data Consider this scenario: There is only one slot left in the whitelist. Two users run the |
Thanks for clarifying @manojmalik20! Might we consider using our |
…mutex Removed the store function Lock and Unlock Whitelist along with the unit tests Added a new mutex in the plugin struct for whitelist Added the logic to lock and unlock mutex in connect slash command handlers Added the logic to lock and unlock mutex in OAuth redirect handler Fixed the failing unit tests
…x while prefilling the whitelist
…s-sync into MI-3629
…serInWhitelist function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @manojmalik20! Awesome to see this simplify things. A few follow up comments.
…s-sync into MI-3629
Removed the use of transaction from the parameters of whitelist functions Fixed the failing unit tests Removed the logic of locking/unlocking whitelist mutex when running connect slash command Added better error handling for duplicate entry errors of Postgres and MySQL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @manojmalik20!
Summary
Related PRs
#342