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
237bc8e3
Commit
237bc8e3
authored
Apr 08, 2020
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove feature flag for dropping duplicate jobs
The feature has been enabled for a few days. Let's remove it.
parent
47ad777a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
69 deletions
+13
-69
changelogs/unreleased/bvl-remove-sidekiq-deduplication-feature-flag.yml
...eleased/bvl-remove-sidekiq-deduplication-feature-flag.yml
+5
-0
lib/gitlab/sidekiq_middleware/duplicate_jobs.rb
lib/gitlab/sidekiq_middleware/duplicate_jobs.rb
+0
-24
lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job.rb
...gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job.rb
+1
-1
spec/lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job_spec.rb
...b/sidekiq_middleware/duplicate_jobs/duplicate_job_spec.rb
+7
-13
spec/lib/gitlab/sidekiq_middleware/duplicate_jobs_spec.rb
spec/lib/gitlab/sidekiq_middleware/duplicate_jobs_spec.rb
+0
-31
No files found.
changelogs/unreleased/bvl-remove-sidekiq-deduplication-feature-flag.yml
0 → 100644
View file @
237bc8e3
---
title
:
Avoid scheduling duplicate sidekiq jobs
merge_request
:
29116
author
:
type
:
performance
lib/gitlab/sidekiq_middleware/duplicate_jobs.rb
deleted
100644 → 0
View file @
47ad777a
# frozen_string_literal: true
require
'digest'
module
Gitlab
module
SidekiqMiddleware
module
DuplicateJobs
DROPPABLE_QUEUES
=
Set
.
new
([
Namespaces
::
RootStatisticsWorker
.
queue
,
Namespaces
::
ScheduleAggregationWorker
.
queue
]).
freeze
def
self
.
drop_duplicates?
(
queue_name
)
Feature
.
enabled?
(
:drop_duplicate_sidekiq_jobs
)
||
drop_duplicates_for_queue?
(
queue_name
)
end
private_class_method
def
self
.
drop_duplicates_for_queue?
(
queue_name
)
DROPPABLE_QUEUES
.
include?
(
queue_name
)
&&
Feature
.
enabled?
(
:drop_duplicate_sidekiq_jobs_for_queue
)
end
end
end
end
lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job.rb
View file @
237bc8e3
...
@@ -67,7 +67,7 @@ module Gitlab
...
@@ -67,7 +67,7 @@ module Gitlab
end
end
def
droppable?
def
droppable?
idempotent?
&&
duplicate?
&&
DuplicateJobs
.
drop_duplicates?
(
queue_name
)
idempotent?
&&
duplicate?
end
end
private
private
...
...
spec/lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job_spec.rb
View file @
237bc8e3
...
@@ -113,28 +113,22 @@ describe Gitlab::SidekiqMiddleware::DuplicateJobs::DuplicateJob, :clean_gitlab_r
...
@@ -113,28 +113,22 @@ describe Gitlab::SidekiqMiddleware::DuplicateJobs::DuplicateJob, :clean_gitlab_r
end
end
describe
'droppable?'
do
describe
'droppable?'
do
where
(
:idempotent
,
:duplicate
,
:feature_enabled
)
do
where
(
:idempotent
,
:duplicate
)
do
# [true, false].repeated_permutation(3)
# [true, false].repeated_permutation(2)
[[
true
,
true
,
true
],
[[
true
,
true
],
[
true
,
true
,
false
],
[
true
,
false
],
[
true
,
false
,
true
],
[
false
,
true
],
[
true
,
false
,
false
],
[
false
,
false
]]
[
false
,
true
,
true
],
[
false
,
true
,
false
],
[
false
,
false
,
true
],
[
false
,
false
,
false
]]
end
end
with_them
do
with_them
do
before
do
before
do
allow
(
AuthorizedProjectsWorker
).
to
receive
(
:idempotent?
).
and_return
(
idempotent
)
allow
(
AuthorizedProjectsWorker
).
to
receive
(
:idempotent?
).
and_return
(
idempotent
)
allow
(
duplicate_job
).
to
receive
(
:duplicate?
).
and_return
(
duplicate
)
allow
(
duplicate_job
).
to
receive
(
:duplicate?
).
and_return
(
duplicate
)
allow
(
Gitlab
::
SidekiqMiddleware
::
DuplicateJobs
)
.
to
receive
(
:drop_duplicates?
).
with
(
queue
).
and_return
(
feature_enabled
)
end
end
it
'is droppable when all conditions are met'
do
it
'is droppable when all conditions are met'
do
if
idempotent
&&
duplicate
&&
feature_enabled
if
idempotent
&&
duplicate
expect
(
duplicate_job
).
to
be_droppable
expect
(
duplicate_job
).
to
be_droppable
else
else
expect
(
duplicate_job
).
not_to
be_droppable
expect
(
duplicate_job
).
not_to
be_droppable
...
...
spec/lib/gitlab/sidekiq_middleware/duplicate_jobs_spec.rb
deleted
100644 → 0
View file @
47ad777a
# frozen_string_literal: true
require
'spec_helper'
describe
Gitlab
::
SidekiqMiddleware
::
DuplicateJobs
do
using
RSpec
::
Parameterized
::
TableSyntax
describe
'.drop_duplicates?'
do
where
(
:global_feature_enabled
,
:selected_queue_enabled
,
:queue
,
:expected
)
do
true
|
true
|
described_class
::
DROPPABLE_QUEUES
.
first
|
true
true
|
true
|
"other_queue"
|
true
true
|
false
|
described_class
::
DROPPABLE_QUEUES
.
first
|
true
true
|
false
|
"other_queue"
|
true
false
|
true
|
described_class
::
DROPPABLE_QUEUES
.
first
|
true
false
|
true
|
"other_queue"
|
false
false
|
false
|
described_class
::
DROPPABLE_QUEUES
.
first
|
false
false
|
false
|
"other_queue"
|
false
end
with_them
do
before
do
stub_feature_flags
(
drop_duplicate_sidekiq_jobs:
global_feature_enabled
,
drop_duplicate_sidekiq_jobs_for_queue:
selected_queue_enabled
)
end
it
"allows dropping jobs when expected"
do
expect
(
described_class
.
drop_duplicates?
(
queue
)).
to
be
(
expected
)
end
end
end
end
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