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
2b6b8643
Commit
2b6b8643
authored
Oct 04, 2016
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cache the last usage data to avoid unicorn timeouts
Closes #1044
parent
2b252c9a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
5 deletions
+7
-5
CHANGELOG-EE.md
CHANGELOG-EE.md
+2
-0
app/workers/gitlab_usage_ping_worker.rb
app/workers/gitlab_usage_ping_worker.rb
+1
-1
lib/gitlab/usage_data.rb
lib/gitlab/usage_data.rb
+4
-4
No files found.
CHANGELOG-EE.md
View file @
2b6b8643
Please view this file on the master branch, on stable branches it's out of date.
## 8.13.0 (2016-10-22)
v 8.13.0 (unreleased)
-
Cache the last usage data to avoid unicorn timeouts
-
Add user activity table and service to query for active users
-
Fix 500 error updating mirror URLs for projects
...
...
app/workers/gitlab_usage_ping_worker.rb
View file @
2b6b8643
...
...
@@ -15,7 +15,7 @@ class GitlabUsagePingWorker
begin
HTTParty
.
post
(
url
,
body:
Gitlab
::
UsageData
.
to_json
,
body:
Gitlab
::
UsageData
.
to_json
(
true
)
,
headers:
{
'Content-type'
=>
'application/json'
}
)
rescue
HTTParty
::
Error
=>
e
...
...
lib/gitlab/usage_data.rb
View file @
2b6b8643
module
Gitlab
class
UsageData
class
<<
self
def
data
Rails
.
cache
.
fetch
(
'usage_data'
,
expires_in:
1
.
hour
)
{
uncached_data
}
def
data
(
force_refresh
=
false
)
Rails
.
cache
.
fetch
(
'usage_data'
,
force:
force_refresh
)
{
uncached_data
}
end
def
uncached_data
license_usage_data
.
merge
(
system_usage_data
)
end
def
to_json
data
.
to_json
def
to_json
(
force_refresh
=
false
)
data
(
force_refresh
)
.
to_json
end
def
system_usage_data
...
...
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