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
3ec71075
Commit
3ec71075
authored
Nov 08, 2017
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Geo Add forced redownload for some type of errors[ci skip]
parent
c598cd87
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
6 deletions
+19
-6
app/services/geo/base_sync_service.rb
app/services/geo/base_sync_service.rb
+5
-0
app/services/geo/repository_sync_service.rb
app/services/geo/repository_sync_service.rb
+1
-0
app/services/geo/wiki_sync_service.rb
app/services/geo/wiki_sync_service.rb
+4
-2
db/geo/migrate/20171101105200_add_retry_count_fields_to_registries.rb
...te/20171101105200_add_retry_count_fields_to_registries.rb
+6
-3
db/geo/schema.rb
db/geo/schema.rb
+3
-1
No files found.
app/services/geo/base_sync_service.rb
View file @
3ec71075
...
...
@@ -66,13 +66,18 @@ module Geo
end
def
should_be_retried?
return
false
if
registry
.
public_send
(
"force_to_redownload_
#{
type
}
"
)
retry_count
<=
RETRY_BEFORE_REDOWNLOAD
end
def
should_be_redownloaded?
return
true
if
registry
.
public_send
(
"force_to_redownload_
#{
type
}
"
)
(
RETRY_BEFORE_REDOWNLOAD
..
RETRY_LIMIT
)
===
retry_count
end
# Progressive backoff
def
delay
(
retry_count
=
0
)
(
retry_count
**
4
)
+
15
+
(
rand
(
30
)
*
(
retry_count
+
1
))
end
...
...
app/services/geo/repository_sync_service.rb
View file @
3ec71075
...
...
@@ -42,6 +42,7 @@ module Geo
log_error
(
'Error syncing repository'
,
e
)
rescue
Gitlab
::
Git
::
Repository
::
NoRepository
=>
e
log_error
(
'Invalid repository'
,
e
)
registry
.
update
(
force_to_redownload_repository:
true
)
log_info
(
'Expiring caches'
)
project
.
repository
.
after_create
ensure
...
...
app/services/geo/wiki_sync_service.rb
View file @
3ec71075
...
...
@@ -34,12 +34,14 @@ module Geo
log_info
(
'Finished wiki sync'
,
update_delay_s:
update_delay_in_seconds
,
download_time_s:
download_time_in_seconds
)
rescue
Gitlab
::
Git
::
Repository
::
NoRepository
,
Gitlab
::
Git
::
RepositoryMirroring
::
RemoteError
,
rescue
Gitlab
::
Git
::
RepositoryMirroring
::
RemoteError
,
Gitlab
::
Shell
::
Error
,
ProjectWiki
::
CouldNotCreateWikiError
,
Geo
::
EmptyCloneUrlPrefixError
=>
e
log_error
(
'Error syncing wiki repository'
,
e
)
rescue
Gitlab
::
Git
::
Repository
::
NoRepository
=>
e
log_error
(
'Invalid wiki'
,
e
)
registry
.
update
(
force_to_redownload_wiki:
true
)
ensure
# Backup can only exist if redownload was unsuccessful
if
with_backup
&&
File
.
exist?
(
backup_path
)
...
...
db/geo/migrate/20171101105200_add_retry_count_fields_to_registries.rb
View file @
3ec71075
class
AddRetryCountFieldsToRegistries
<
ActiveRecord
::
Migration
def
change
add_column
:file_registry
,
:retry_count
,
:integer
add_column
:project_registry
,
:repository_retry_count
,
:integer
add_column
:project_registry
,
:wiki_retry_count
,
:integer
add_column
:file_registry
,
:retry_at
,
:datetime
add_column
:project_registry
,
:repository_retry_count
,
:integer
add_column
:project_registry
,
:repository_retry_at
,
:datetime
add_column
:project_registry
,
:force_to_redownload_repository
,
:boolean
add_column
:project_registry
,
:wiki_retry_count
,
:integer
add_column
:project_registry
,
:wiki_retry_at
,
:datetime
add_column
:
file_registry
,
:retry_at
,
:datetime
add_column
:
project_registry
,
:force_to_redownload_wiki
,
:boolean
end
end
db/geo/schema.rb
View file @
3ec71075
...
...
@@ -44,9 +44,11 @@ ActiveRecord::Schema.define(version: 20171101105200) do
t
.
datetime
"last_wiki_synced_at"
t
.
datetime
"last_wiki_successful_sync_at"
t
.
integer
"repository_retry_count"
t
.
integer
"wiki_retry_count"
t
.
datetime
"repository_retry_at"
t
.
boolean
"force_to_redownload_repository"
t
.
integer
"wiki_retry_count"
t
.
datetime
"wiki_retry_at"
t
.
boolean
"force_to_redownload_wiki"
end
add_index
"project_registry"
,
[
"last_repository_successful_sync_at"
],
name:
"index_project_registry_on_last_repository_successful_sync_at"
,
using: :btree
...
...
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