Commit 68aca6f6 authored by James Lopez's avatar James Lopez

trying to fix timing issue with import status

parent 1322c981
......@@ -19,8 +19,11 @@ class Projects::ImportsController < Projects::ApplicationController
if @project.import_failed?
@project.import_retry
else
Project.transaction do
@project.import_start
end
@project.add_import_job if @project.persisted?
end
end
redirect_to namespace_project_import_path(@project.namespace, @project)
......
......@@ -246,7 +246,6 @@ class Project < ActiveRecord::Base
state :finished
state :failed
after_transition any => :started, do: :schedule_add_import_job
after_transition any => :finished, do: :clear_import_data
end
......@@ -385,10 +384,6 @@ class Project < ActiveRecord::Base
id && persisted?
end
def schedule_add_import_job
run_after_commit(:add_import_job)
end
def add_import_job
if forked?
job_id = RepositoryForkWorker.perform_async(self.id, forked_from_project.path_with_namespace, self.namespace.path)
......
......@@ -59,6 +59,10 @@ module Projects
end
end
Project.transaction do
@project.import_start if @project.import?
end
after_create_actions if @project.persisted?
@project
......@@ -95,8 +99,6 @@ module Projects
unless @project.group
@project.team << [current_user, :master, current_user]
end
@project.import_start if @project.import?
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment