Commit f0c6b9cf authored by Stan Hu's avatar Stan Hu

Put in an explicit expiration time and add spec

parent 2b6b8643
......@@ -2,7 +2,7 @@ module Gitlab
class UsageData
class << self
def data(force_refresh = false)
Rails.cache.fetch('usage_data', force: force_refresh) { uncached_data }
Rails.cache.fetch('usage_data', force: force_refresh, expires_in: 2.weeks) { uncached_data }
end
def uncached_data
......
......@@ -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(true).and_call_original
expect(subject).to receive(:try_obtain_lease).and_return(true)
expect(subject.perform.response.code.to_i).to eq(200)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment