Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
b47646ef
Commit
b47646ef
authored
Mar 12, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add retry feature to project import
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
37db76a3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
6 deletions
+28
-6
app/models/project.rb
app/models/project.rb
+25
-3
app/services/projects/create_service.rb
app/services/projects/create_service.rb
+1
-1
app/workers/repository_import_worker.rb
app/workers/repository_import_worker.rb
+0
-2
config/routes.rb
config/routes.rb
+2
-0
No files found.
app/models/project.rb
View file @
b47646ef
...
...
@@ -126,12 +126,18 @@ class Project < ActiveRecord::Base
end
event
:import_fail
do
transition
:started
=>
:timeout
transition
:started
=>
:failed
end
event
:import_retry
do
transition
:failed
=>
:started
end
state
:started
state
:finished
state
:timeout
state
:failed
after_transition
any
=>
:started
,
:do
=>
:add_import_job
end
class
<<
self
...
...
@@ -210,12 +216,28 @@ class Project < ActiveRecord::Base
id
&&
persisted?
end
def
add_import_job
RepositoryImportWorker
.
perform_in
(
2
.
seconds
,
id
)
end
def
import?
import_url
.
present?
end
def
imported?
imported
import_finished?
end
def
import_in_progress?
import?
&&
import_status
==
'started'
end
def
import_failed?
import_status
==
'failed'
end
def
import_finished?
import_status
==
'finished'
end
def
check_limit
...
...
app/services/projects/create_service.rb
View file @
b47646ef
...
...
@@ -62,7 +62,7 @@ module Projects
@project
.
update_column
(
:last_activity_at
,
@project
.
created_at
)
if
@project
.
import?
RepositoryImportWorker
.
perform_in
(
5
.
seconds
,
@project
.
id
)
@project
.
import_start
else
GitlabShellWorker
.
perform_async
(
:add_repository
,
...
...
app/workers/repository_import_worker.rb
View file @
b47646ef
...
...
@@ -6,8 +6,6 @@ class RepositoryImportWorker
def
perform
(
project_id
)
project
=
Project
.
find
(
project_id
)
project
.
import_start
result
=
gitlab_shell
.
send
(
:import_repository
,
project
.
path_with_namespace
,
project
.
import_url
)
...
...
config/routes.rb
View file @
b47646ef
...
...
@@ -179,6 +179,8 @@ Gitlab::Application.routes.draw do
post
:archive
post
:unarchive
get
:autocomplete_sources
get
:import
put
:retry_import
end
scope
module: :projects
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment