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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
d91c6c07
Commit
d91c6c07
authored
Jul 05, 2016
by
Paco Guzman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Throttle the update of `project.pushes_since_gc` to 1 minute
parent
ba9ef7f3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
CHANGELOG
CHANGELOG
+1
-0
app/services/projects/housekeeping_service.rb
app/services/projects/housekeeping_service.rb
+8
-2
No files found.
CHANGELOG
View file @
d91c6c07
...
@@ -23,6 +23,7 @@ v 8.10.0 (unreleased)
...
@@ -23,6 +23,7 @@ v 8.10.0 (unreleased)
- API: Todos !3188 (Robert Schilling)
- API: Todos !3188 (Robert Schilling)
- Fix user creation with stronger minimum password requirements !4054 (nathan-pmt)
- Fix user creation with stronger minimum password requirements !4054 (nathan-pmt)
- PipelinesFinder uses git cache data
- PipelinesFinder uses git cache data
- Throttle the update of `project.pushes_since_gc` to 1 minute.
- Check for conflicts with existing Project's wiki path when creating a new project.
- Check for conflicts with existing Project's wiki path when creating a new project.
- Don't instantiate a git tree on Projects show default view
- Don't instantiate a git tree on Projects show default view
- Remove unused front-end variable -> default_issues_tracker
- Remove unused front-end variable -> default_issues_tracker
...
...
app/services/projects/housekeeping_service.rb
View file @
d91c6c07
...
@@ -27,7 +27,7 @@ module Projects
...
@@ -27,7 +27,7 @@ module Projects
GitlabShellOneShotWorker
.
perform_async
(
:gc
,
@project
.
repository_storage_path
,
@project
.
path_with_namespace
)
GitlabShellOneShotWorker
.
perform_async
(
:gc
,
@project
.
repository_storage_path
,
@project
.
path_with_namespace
)
ensure
ensure
Gitlab
::
Metrics
.
measure
(
:reset_pushes_since_gc
)
do
Gitlab
::
Metrics
.
measure
(
:reset_pushes_since_gc
)
do
@project
.
update_column
(
:pushes_since_gc
,
0
)
update_pushes_since_gc
(
0
)
end
end
end
end
...
@@ -37,12 +37,18 @@ module Projects
...
@@ -37,12 +37,18 @@ module Projects
def
increment!
def
increment!
Gitlab
::
Metrics
.
measure
(
:increment_pushes_since_gc
)
do
Gitlab
::
Metrics
.
measure
(
:increment_pushes_since_gc
)
do
@project
.
increment!
(
:pushes_since_gc
)
update_pushes_since_gc
(
@project
.
pushes_since_gc
+
1
)
end
end
end
end
private
private
def
update_pushes_since_gc
(
new_value
)
if
Gitlab
::
ExclusiveLease
.
new
(
"project_housekeeping:update_pushes_since_gc:
#{
project
.
id
}
"
,
timeout:
60
).
try_obtain
@project
.
update_column
(
:pushes_since_gc
,
new_value
)
end
end
def
try_obtain_lease
def
try_obtain_lease
Gitlab
::
Metrics
.
measure
(
:obtain_housekeeping_lease
)
do
Gitlab
::
Metrics
.
measure
(
:obtain_housekeeping_lease
)
do
lease
=
::
Gitlab
::
ExclusiveLease
.
new
(
"project_housekeeping:
#{
@project
.
id
}
"
,
timeout:
LEASE_TIMEOUT
)
lease
=
::
Gitlab
::
ExclusiveLease
.
new
(
"project_housekeeping:
#{
@project
.
id
}
"
,
timeout:
LEASE_TIMEOUT
)
...
...
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