Skip to content

Fix error while seeding projects in database

username-removed-283999 requested to merge da-fix-db-seed into master
`RepositoryImportWorker.perform_async` cannot be called inside a transaction as this can lead to
race conditions when the worker runs before the transaction is committed and
tries to access a model that has not been saved yet.

Use an `after_commit` hook, or include `AfterCommitQueue` and use a `run_after_commit` block instead.
.rvm/gems/ruby-2.3.3/gems/seed-fu-2.3.6/lib/seed-fu/runner.rb:46:in `eval'
gitlab/app/models/project.rb:476:in `add_import_job'
gitlab/app/models/project.rb:331:in `block (3 levels) in <class:Project>'

/cc @MadLittleMods

Merge request reports