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

Allow more retries on activity_status deadlock errors #4903

Merged
merged 2 commits into from
Aug 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/models/activity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -446,14 +446,14 @@
end

def activity_status_for!(user, series = nil)
first_try = true
tries = 0
begin
ActivityStatus.find_or_create_by(activity: self, series: series, user: user)
rescue StandardError
# https://github.com/dodona-edu/dodona/issues/1877
raise unless first_try
# https://github.com/dodona-edu/dodona/pull/4903
raise unless tries < 3

Check warning on line 454 in app/models/activity.rb

View check run for this annotation

Codecov / codecov/patch

app/models/activity.rb#L454

Added line #L454 was not covered by tests

first_try = false
tries += 1

Check warning on line 456 in app/models/activity.rb

View check run for this annotation

Codecov / codecov/patch

app/models/activity.rb#L456

Added line #L456 was not covered by tests
retry
end
end
Expand Down