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
f30a46b4
Commit
f30a46b4
authored
Oct 19, 2016
by
Stan Hu
Committed by
Rémy Coutable
Apr 14, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Used named parameter for refreshing usage data
parent
bca36899
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
5 deletions
+6
-5
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
spec/workers/gitlab_usage_ping_worker_spec.rb
spec/workers/gitlab_usage_ping_worker_spec.rb
+1
-0
No files found.
app/workers/gitlab_usage_ping_worker.rb
View file @
f30a46b4
...
...
@@ -15,7 +15,7 @@ class GitlabUsagePingWorker
begin
HTTParty
.
post
(
url
,
body:
Gitlab
::
UsageData
.
to_json
(
true
),
body:
Gitlab
::
UsageData
.
to_json
(
force_refresh:
true
),
headers:
{
'Content-type'
=>
'application/json'
}
)
rescue
HTTParty
::
Error
=>
e
...
...
lib/gitlab/usage_data.rb
View file @
f30a46b4
...
...
@@ -3,16 +3,16 @@ module Gitlab
include
Gitlab
::
CurrentSettings
class
<<
self
def
data
(
force_refresh
=
false
)
Rails
.
cache
.
fetch
(
'usage_data'
,
force:
force_refresh
)
{
uncached_data
}
def
data
(
force_refresh
:
false
)
Rails
.
cache
.
fetch
(
'usage_data'
,
force:
force_refresh
,
expires_in:
2
.
weeks
)
{
uncached_data
}
end
def
uncached_data
license_usage_data
.
merge
(
system_usage_data
)
end
def
to_json
(
force_refresh
=
false
)
data
(
force_refresh
).
to_json
def
to_json
(
force_refresh
:
false
)
data
(
force_refresh
:
force_refresh
).
to_json
end
def
system_usage_data
...
...
spec/workers/gitlab_usage_ping_worker_spec.rb
View file @
f30a46b4
...
...
@@ -8,6 +8,7 @@ describe GitlabUsagePingWorker do
stub_request
(
:post
,
"https://version.gitlab.com/usage_data"
).
to_return
(
status:
200
,
body:
''
,
headers:
{})
expect
(
Gitlab
::
UsageData
).
to
receive
(
:to_json
).
with
({
force_refresh:
true
}).
and_call_original
expect
(
subject
).
to
receive
(
:try_obtain_lease
).
and_return
(
true
)
expect
(
subject
.
perform
.
response
.
code
.
to_i
).
to
eq
(
200
)
...
...
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