Commit 1e283621 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch 'eb-reduce-refresh-stale-window' into 'master'

Reduce refresh stale window to 2 hours

See merge request gitlab-org/gitlab!84295
parents 4dc48bc2 cca119f4
......@@ -4,7 +4,7 @@ module Projects
class BuildArtifactsSizeRefresh < ApplicationRecord
include BulkInsertSafe
STALE_WINDOW = 3.days
STALE_WINDOW = 2.hours
self.table_name = 'project_build_artifacts_size_refreshes'
......
......@@ -14,13 +14,13 @@ RSpec.describe Projects::BuildArtifactsSizeRefresh, type: :model do
end
describe 'scopes' do
let_it_be(:refresh_1) { create(:project_build_artifacts_size_refresh, :running, updated_at: 4.days.ago) }
let_it_be(:refresh_2) { create(:project_build_artifacts_size_refresh, :running, updated_at: 2.days.ago) }
let_it_be(:refresh_1) { create(:project_build_artifacts_size_refresh, :running, updated_at: (described_class::STALE_WINDOW + 1.second).ago) }
let_it_be(:refresh_2) { create(:project_build_artifacts_size_refresh, :running, updated_at: 1.hour.ago) }
let_it_be(:refresh_3) { create(:project_build_artifacts_size_refresh, :pending) }
let_it_be(:refresh_4) { create(:project_build_artifacts_size_refresh, :created) }
describe 'stale' do
it 'returns records in running state and has not been updated for more than 3 days' do
it 'returns records in running state and has not been updated for more than 2 hours' do
expect(described_class.stale).to eq([refresh_1])
end
end
......
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