Fix bug where projects would appear to be stuck in the forked import state
A race condition existed between when Rails committed the import_status
to
started
and when the Sidekiq worker forked a project. If this fork were quick,
it's possible that the worker would attempt to move into the finished
state
before the started
state took effect.
As mentioned in https://github.com/mperham/sidekiq/wiki/Problems-and-Troubleshooting#cannot-find-modelname-with-id12345,
we can either delay the worker to ensure the DB has a chance to update, or use the nice after_commit_queue
gem to schedule the task after the state machine commit. See:
- https://github.com/pluginaweek/state_machine/issues/191
- https://github.com/shellycloud/after_commit_queue
Closes #2736 (closed)
Merge request reports
Activity
mentioned in issue #2572 (closed)
Added 1 commit:
- bd2991b4 - Use after_commit_queue to schedule import job immediately
Reassigned to @dzaporozhets
mentioned in commit f68acbac
mentioned in commit df1a235f
Same problem here https://gitlab.com/gitlab-org/gitlab-ce/issues/23111, but I'm not sure if using gem (that is likely to be abandoned) is a good long-term solution.
Edited by Grzegorz BizonMentioned in commit maxraab/gitlab-ce@df1a235f
mentioned in issue #38345 (closed)