Skip to content

Commit

Permalink
Discard StagingProjectAcceptJob on InvalidStateError
Browse files Browse the repository at this point in the history
This can happen when at the same time of scheduling the job
there will be a new request selected to the staging project.
Or somehow a staged request changes state in the same time.

If we discard the job on this error, the staging project state
calcuclation will be done again.

Partially addresses #10636
  • Loading branch information
hennevogel committed Sep 1, 2021
1 parent 2eeb616 commit bd00e81
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/api/app/jobs/staging_project_accept_job.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
class StagingProjectAcceptJob < ApplicationJob
queue_as :staging

discard_on BsRequest::Errors::InvalidStateError

def perform(payload)
User.find_by!(login: payload[:user_login]).run_as do
accept(Project.find(payload[:project_id]))
Expand Down

0 comments on commit bd00e81

Please sign in to comment.