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
f6dfba53
Commit
f6dfba53
authored
Jun 13, 2018
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Store when a registry is marked dirty
parent
6902a422
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
3 deletions
+39
-3
ee/db/geo/migrate/20180613184349_add_resync_was_scheduled_at_to_project_registry.rb
...184349_add_resync_was_scheduled_at_to_project_registry.rb
+10
-0
ee/db/geo/schema.rb
ee/db/geo/schema.rb
+3
-1
ee/lib/gitlab/geo/log_cursor/events/repository_updated_event.rb
.../gitlab/geo/log_cursor/events/repository_updated_event.rb
+8
-2
ee/spec/lib/gitlab/geo/log_cursor/events/repository_updated_event_spec.rb
...ab/geo/log_cursor/events/repository_updated_event_spec.rb
+18
-0
No files found.
ee/db/geo/migrate/20180613184349_add_resync_was_scheduled_at_to_project_registry.rb
0 → 100644
View file @
f6dfba53
class
AddResyncWasScheduledAtToProjectRegistry
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
def
change
add_column
:project_registry
,
:resync_repository_was_scheduled_at
,
:datetime_with_timezone
add_column
:project_registry
,
:resync_wiki_was_scheduled_at
,
:datetime_with_timezone
end
end
ee/db/geo/schema.rb
View file @
f6dfba53
...
...
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
20180
510223634
)
do
ActiveRecord
::
Schema
.
define
(
version:
20180
613184349
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
...
...
@@ -76,6 +76,8 @@ ActiveRecord::Schema.define(version: 20180510223634) do
t
.
boolean
"wiki_checksum_mismatch"
,
default:
false
,
null:
false
t
.
boolean
"last_repository_check_failed"
t
.
datetime_with_timezone
"last_repository_check_at"
t
.
datetime_with_timezone
"resync_repository_was_scheduled_at"
t
.
datetime_with_timezone
"resync_wiki_was_scheduled_at"
end
add_index
"project_registry"
,
[
"last_repository_successful_sync_at"
],
name:
"index_project_registry_on_last_repository_successful_sync_at"
,
using: :btree
...
...
ee/lib/gitlab/geo/log_cursor/events/repository_updated_event.rb
View file @
f6dfba53
...
...
@@ -9,7 +9,7 @@ module Gitlab
registry
.
save!
job_id
=
enqueue_job_if_shard_healthy
(
event
)
do
::
Geo
::
ProjectSyncWorker
.
perform_async
(
event
.
project_id
,
Time
.
now
)
::
Geo
::
ProjectSyncWorker
.
perform_async
(
event
.
project_id
,
scheduled_at
)
end
log_event
(
job_id
)
...
...
@@ -22,7 +22,8 @@ module Gitlab
"resync_
#{
event
.
source
}
"
=>
true
,
"
#{
event
.
source
}
_verification_checksum_sha"
=>
nil
,
"
#{
event
.
source
}
_checksum_mismatch"
=>
false
,
"last_
#{
event
.
source
}
_verification_failure"
=>
nil
"last_
#{
event
.
source
}
_verification_failure"
=>
nil
,
"resync_
#{
event
.
source
}
_was_scheduled_at"
=>
scheduled_at
)
end
...
...
@@ -34,8 +35,13 @@ module Gitlab
source:
event
.
source
,
resync_repository:
registry
.
resync_repository
,
resync_wiki:
registry
.
resync_wiki
,
scheduled_at:
scheduled_at
,
job_id:
job_id
)
end
def
scheduled_at
@scheduled_at
||=
Time
.
now
end
end
end
end
...
...
ee/spec/lib/gitlab/geo/log_cursor/events/repository_updated_event_spec.rb
View file @
f6dfba53
...
...
@@ -52,6 +52,15 @@ describe Gitlab::Geo::LogCursor::Events::RepositoryUpdatedEvent, :postgresql, :c
last_repository_verification_failure:
nil
)
end
it
'sets resync_repository_was_scheduled_at to the scheduled time'
do
Timecop
.
freeze
do
subject
.
process
reloaded_registry
=
registry
.
reload
expect
(
reloaded_registry
.
resync_repository_was_scheduled_at
).
to
be_within
(
1
.
second
).
of
(
Time
.
now
)
end
end
end
context
'when the event source is a wiki'
do
...
...
@@ -73,6 +82,15 @@ describe Gitlab::Geo::LogCursor::Events::RepositoryUpdatedEvent, :postgresql, :c
expect
(
reloaded_registry
.
wiki_checksum_mismatch
).
to
be
false
expect
(
reloaded_registry
.
last_wiki_verification_failure
).
to
be_nil
end
it
'sets resync_wiki_was_scheduled_at to the scheduled time'
do
Timecop
.
freeze
do
subject
.
process
reloaded_registry
=
registry
.
reload
expect
(
reloaded_registry
.
resync_wiki_was_scheduled_at
).
to
be_within
(
1
.
second
).
of
(
Time
.
now
)
end
end
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