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
c06fa392
Commit
c06fa392
authored
Nov 14, 2016
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rebuild cache after Geo repository update
parent
74e7f50a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletion
+18
-1
app/workers/geo_repository_update_worker.rb
app/workers/geo_repository_update_worker.rb
+1
-0
app/workers/project_cache_worker.rb
app/workers/project_cache_worker.rb
+17
-1
No files found.
app/workers/geo_repository_update_worker.rb
View file @
c06fa392
...
...
@@ -9,6 +9,7 @@ class GeoRepositoryUpdateWorker
@project
=
Project
.
find
(
project_id
)
fetch_repository
(
clone_url
)
ProjectCacheWorker
.
perform_async
(
@project
.
id
)
end
private
...
...
app/workers/project_cache_worker.rb
View file @
c06fa392
...
...
@@ -32,7 +32,11 @@ class ProjectCacheWorker
return
end
update_caches
(
project_id
)
if
Gitlab
::
Geo
.
secondary?
update_geo_caches
(
project_id
)
else
update_caches
(
project_id
)
end
end
def
update_caches
(
project_id
)
...
...
@@ -48,6 +52,18 @@ class ProjectCacheWorker
end
end
# Geo should only update Redis based cache, as data store in the database
# will be updated on primary and replicated to the secondaries.
def
update_geo_caches
(
project_id
)
project
=
Project
.
find
(
project_id
)
return
unless
project
.
repository
.
exists?
if
project
.
repository
.
root_ref
project
.
repository
.
build_cache
end
end
def
try_obtain_lease_for
(
project_id
)
self
.
class
.
lease_for
(
project_id
).
try_obtain
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