Skip to content

Commit

Permalink
Merge pull request #4903 from dodona-edu/fix/activity-status-deadlocks
Browse files Browse the repository at this point in the history
Allow more retries on activity_status deadlock errors
  • Loading branch information
jorg-vr authored Aug 17, 2023
2 parents 1be48ad + 25a8ed4 commit fd5c98f
Showing 1 changed file with 4 additions and 4 deletions.
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 @@ def activity_status_for(user, series = nil)
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

first_try = false
tries += 1
retry
end
end
Expand Down

0 comments on commit fd5c98f

Please sign in to comment.