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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
469eb8ed
Commit
469eb8ed
authored
Jun 21, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix remote mirror stuck on started issue
parent
5a688e4f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
2 deletions
+11
-2
app/models/remote_mirror.rb
app/models/remote_mirror.rb
+1
-1
app/services/projects/update_remote_mirror_service.rb
app/services/projects/update_remote_mirror_service.rb
+1
-1
spec/models/remote_mirror_spec.rb
spec/models/remote_mirror_spec.rb
+9
-0
No files found.
app/models/remote_mirror.rb
View file @
469eb8ed
...
...
@@ -34,7 +34,7 @@ class RemoteMirror < ActiveRecord::Base
scope
:enabled
,
->
{
where
(
enabled:
true
)
}
scope
:started
,
->
{
with_update_status
(
:started
)
}
scope
:stuck
,
->
{
started
.
where
(
'last_update_at < ?
'
,
1
.
day
.
ago
)
}
scope
:stuck
,
->
{
started
.
where
(
'last_update_at < ?
OR (last_update_at IS NULL AND updated_at < ?)'
,
1
.
day
.
ago
,
1
.
day
.
ago
)
}
state_machine
:update_status
,
initial: :none
do
event
:update_start
do
...
...
app/services/projects/update_remote_mirror_service.rb
View file @
469eb8ed
...
...
@@ -18,7 +18,7 @@ module Projects
push_tags
if
changed_tags
.
present?
delete_tags
if
deleted_tags
.
present?
rescue
Gitlab
::
Shell
::
Error
=>
e
rescue
=>
e
errors
<<
e
.
message
.
strip
end
...
...
spec/models/remote_mirror_spec.rb
View file @
469eb8ed
...
...
@@ -43,6 +43,15 @@ describe RemoteMirror do
expect
(
mirror
.
url
).
to
eq
(
'http://foo:bar@test.com'
)
expect
(
mirror
.
credentials
).
to
eq
({
user:
'foo'
,
password:
'bar'
})
end
it
'should still be picked up by the worker if is stuck'
do
mirror
=
create_mirror_with_url
(
'http://test.com'
)
mirror
.
update_attribute
(
:update_status
,
'started'
)
# this will reset some of the updated_at fields
mirror
.
update_attribute
(
:url
,
'http://foo:bar@test.com'
)
expect
(
RemoteMirror
.
stuck
.
last
).
to
eq
(
mirror
)
end
end
end
...
...
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