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

trying to fix timing issue with import status

parent 1322c981
...@@ -19,7 +19,10 @@ class Projects::ImportsController < Projects::ApplicationController ...@@ -19,7 +19,10 @@ class Projects::ImportsController < Projects::ApplicationController
if @project.import_failed? if @project.import_failed?
@project.import_retry @project.import_retry
else else
@project.import_start Project.transaction do
@project.import_start
end
@project.add_import_job if @project.persisted?
end end
end end
......
...@@ -246,7 +246,6 @@ class Project < ActiveRecord::Base ...@@ -246,7 +246,6 @@ class Project < ActiveRecord::Base
state :finished state :finished
state :failed state :failed
after_transition any => :started, do: :schedule_add_import_job
after_transition any => :finished, do: :clear_import_data after_transition any => :finished, do: :clear_import_data
end end
...@@ -385,10 +384,6 @@ class Project < ActiveRecord::Base ...@@ -385,10 +384,6 @@ class Project < ActiveRecord::Base
id && persisted? id && persisted?
end end
def schedule_add_import_job
run_after_commit(:add_import_job)
end
def add_import_job def add_import_job
if forked? if forked?
job_id = RepositoryForkWorker.perform_async(self.id, forked_from_project.path_with_namespace, self.namespace.path) job_id = RepositoryForkWorker.perform_async(self.id, forked_from_project.path_with_namespace, self.namespace.path)
......
...@@ -59,6 +59,10 @@ module Projects ...@@ -59,6 +59,10 @@ module Projects
end end
end end
Project.transaction do
@project.import_start if @project.import?
end
after_create_actions if @project.persisted? after_create_actions if @project.persisted?
@project @project
...@@ -95,8 +99,6 @@ module Projects ...@@ -95,8 +99,6 @@ module Projects
unless @project.group unless @project.group
@project.team << [current_user, :master, current_user] @project.team << [current_user, :master, current_user]
end end
@project.import_start if @project.import?
end end
end 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