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
9de1a6cf
Commit
9de1a6cf
authored
Jun 02, 2021
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure progressive backoff of syncs-due-to-verification-failures
parent
f9e90487
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
3 deletions
+37
-3
ee/app/models/concerns/geo/verifiable_registry.rb
ee/app/models/concerns/geo/verifiable_registry.rb
+1
-0
ee/lib/gitlab/geo/verification_state.rb
ee/lib/gitlab/geo/verification_state.rb
+9
-3
ee/spec/lib/gitlab/geo/verification_state_spec.rb
ee/spec/lib/gitlab/geo/verification_state_spec.rb
+27
-0
No files found.
ee/app/models/concerns/geo/verifiable_registry.rb
View file @
9de1a6cf
...
@@ -39,6 +39,7 @@ module Geo
...
@@ -39,6 +39,7 @@ module Geo
extend
::
Gitlab
::
Utils
::
Override
extend
::
Gitlab
::
Utils
::
Override
sha_attribute
:verification_checksum_mismatched
sha_attribute
:verification_checksum_mismatched
scope
:available_verifiables
,
->
{
all
}
scope
:available_verifiables
,
->
{
all
}
override
:clear_verification_failure_fields!
override
:clear_verification_failure_fields!
...
...
ee/lib/gitlab/geo/verification_state.rb
View file @
9de1a6cf
...
@@ -22,6 +22,7 @@ module Gitlab
...
@@ -22,6 +22,7 @@ module Gitlab
verification_succeeded:
2
,
verification_succeeded:
2
,
verification_failed:
3
verification_failed:
3
}.
freeze
}.
freeze
VERIFICATION_TIMEOUT
=
8
.
hours
VERIFICATION_TIMEOUT
=
8
.
hours
included
do
included
do
...
@@ -54,9 +55,14 @@ module Gitlab
...
@@ -54,9 +55,14 @@ module Gitlab
instance
.
verification_started_at
=
Time
.
current
instance
.
verification_started_at
=
Time
.
current
end
end
before_transition
any
=>
:verification_pending
do
|
instance
,
_
|
before_transition
[
:verification_pending
,
:verification_started
,
:verification_succeeded
]
=>
:verification_pending
do
|
instance
,
_
|
instance
.
verification_retry_count
=
0
instance
.
clear_verification_failure_fields!
instance
.
verification_retry_at
=
nil
end
before_transition
verification_failed: :verification_pending
do
|
instance
,
_
|
# If transitioning from verification_failed, then don't clear
# verification_retry_count and verification_retry_at to ensure
# progressive backoff of syncs-due-to-verification-failures
instance
.
verification_failure
=
nil
instance
.
verification_failure
=
nil
end
end
...
...
ee/spec/lib/gitlab/geo/verification_state_spec.rb
View file @
9de1a6cf
...
@@ -23,6 +23,33 @@ RSpec.describe Gitlab::Geo::VerificationState do
...
@@ -23,6 +23,33 @@ RSpec.describe Gitlab::Geo::VerificationState do
subject
{
DummyModel
.
new
}
subject
{
DummyModel
.
new
}
context
'state machine'
do
context
'when failed'
do
before
do
subject
.
verification_started
subject
.
verification_failed_with_message!
(
'foo'
)
end
context
'and transitioning to pending'
do
it
'marks verification as pending'
do
subject
.
verification_pending!
expect
(
subject
.
reload
.
verification_pending?
).
to
be_truthy
end
it
'does not clear retry attributes'
do
subject
.
verification_pending!
expect
(
subject
.
reload
).
to
have_attributes
(
verification_state:
DummyModel
.
verification_state_value
(
:verification_pending
),
verification_retry_count:
1
,
verification_retry_at:
be_present
)
end
end
end
end
describe
'.verification_pending_batch'
do
describe
'.verification_pending_batch'
do
# Insert 2 records for a total of 3 with subject
# Insert 2 records for a total of 3 with subject
let!
(
:other_pending_records
)
do
let!
(
:other_pending_records
)
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