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

Avoid race conditions when queuing actions (hopefully fixes #879) #883

Merged
merged 2 commits into from
Apr 22, 2024

Conversation

Jannis
Copy link
Contributor

@Jannis Jannis commented Apr 22, 2024

I noticed that the existing actions that the new actions are compared against to check for duplicates are queried outside the Sequelize transaction that will eventually write the action to the db. We've noticed that duplicates happen when two actions are added to the database in quick succession (<2s). By performing both the existing action queries and the database write within the same transaction, this hopefully won't happen any more.

This hopefully fixes duplicate actions being added to the queue (#879).

…hActions

This can be useful in situations where the actions need
to be queried in the context of a transcation, such as
when queuing a new action and wanting to check for duplicates.
@Jannis Jannis added the bug Something isn't working label Apr 22, 2024
@Jannis Jannis requested a review from fordN April 22, 2024 13:59
@Jannis Jannis self-assigned this Apr 22, 2024
Copy link
Contributor

@fordN fordN left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@Jannis Jannis merged commit 38ab2c0 into main Apr 22, 2024
10 checks passed
@Jannis Jannis deleted the jannis/fix-duplicate-action-race branch April 22, 2024 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants