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
ce18c523
Commit
ce18c523
authored
Oct 14, 2020
by
Brett Walker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete rogue BackfillJiraTrackerDeploymentType
sidekiq jobs
parent
f8a5fec6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
89 additions
and
0 deletions
+89
-0
changelogs/unreleased/bw-delete-jira-tracker-data-jobs.yml
changelogs/unreleased/bw-delete-jira-tracker-data-jobs.yml
+5
-0
db/migrate/20201014205300_drop_backfill_jira_tracker_deployment_type_jobs.rb
...205300_drop_backfill_jira_tracker_deployment_type_jobs.rb
+25
-0
db/schema_migrations/20201014205300
db/schema_migrations/20201014205300
+1
-0
spec/migrations/20201014205300_drop_backfill_jira_tracker_deployment_type_jobs_spec.rb
...0_drop_backfill_jira_tracker_deployment_type_jobs_spec.rb
+58
-0
No files found.
changelogs/unreleased/bw-delete-jira-tracker-data-jobs.yml
0 → 100644
View file @
ce18c523
---
title
:
Delete any outstanding BackfillJiraTrackerDeploymentType
merge_request
:
45219
author
:
type
:
fixed
db/migrate/20201014205300_drop_backfill_jira_tracker_deployment_type_jobs.rb
0 → 100644
View file @
ce18c523
# frozen_string_literal: true
class
DropBackfillJiraTrackerDeploymentTypeJobs
<
ActiveRecord
::
Migration
[
6.0
]
DOWNTIME
=
false
DROPPED_JOB_CLASS
=
'BackfillJiraTrackerDeploymentType'
.
freeze
QUEUE
=
'background_migration'
.
freeze
def
up
sidekiq_queues
.
each
do
|
queue
|
queue
.
each
do
|
job
|
next
unless
job
.
args
.
first
==
DROPPED_JOB_CLASS
job
.
delete
end
end
end
def
down
# no-op
end
def
sidekiq_queues
[
Sidekiq
::
ScheduledSet
.
new
,
Sidekiq
::
RetrySet
.
new
,
Sidekiq
::
Queue
.
new
(
QUEUE
)]
end
end
db/schema_migrations/20201014205300
0 → 100644
View file @
ce18c523
05352623a59d56c1633317ba7dbaba7d75bb8e529a748a90512dcf3641b8d3cb
\ No newline at end of file
spec/migrations/20201014205300_drop_backfill_jira_tracker_deployment_type_jobs_spec.rb
0 → 100644
View file @
ce18c523
# frozen_string_literal: true
require
'spec_helper'
require
Rails
.
root
.
join
(
'db'
,
'migrate'
,
'20201014205300_drop_backfill_jira_tracker_deployment_type_jobs.rb'
)
RSpec
.
describe
DropBackfillJiraTrackerDeploymentTypeJobs
,
:sidekiq
,
:redis
,
schema:
2020_10_14_205300
do
subject
(
:migration
)
{
described_class
.
new
}
describe
'#up'
do
let
(
:retry_set
)
{
Sidekiq
::
RetrySet
.
new
}
let
(
:scheduled_set
)
{
Sidekiq
::
ScheduledSet
.
new
}
context
'there are only affected jobs on the queue'
do
let
(
:payload
)
{
{
'class'
=>
::
BackgroundMigrationWorker
,
'args'
=>
[
described_class
::
DROPPED_JOB_CLASS
,
1
]
}
}
let
(
:queue_payload
)
{
payload
.
merge
(
'queue'
=>
described_class
::
QUEUE
)
}
it
'removes enqueued BackfillJiraTrackerDeploymentType background jobs'
do
Sidekiq
::
Testing
.
disable!
do
# https://github.com/mperham/sidekiq/wiki/testing#api Sidekiq's API does not have a testing mode
retry_set
.
schedule
(
1
.
hour
.
from_now
,
payload
)
scheduled_set
.
schedule
(
1
.
hour
.
from_now
,
payload
)
Sidekiq
::
Client
.
push
(
queue_payload
)
expect
{
migration
.
up
}.
to
change
{
Sidekiq
::
Queue
.
new
(
described_class
::
QUEUE
).
size
}.
from
(
1
).
to
(
0
)
expect
(
retry_set
.
size
).
to
eq
(
0
)
expect
(
scheduled_set
.
size
).
to
eq
(
0
)
end
end
end
context
'there are not any affected jobs on the queue'
do
let
(
:payload
)
{
{
'class'
=>
::
BackgroundMigrationWorker
,
'args'
=>
[
'SomeOtherClass'
,
1
]
}
}
let
(
:queue_payload
)
{
payload
.
merge
(
'queue'
=>
described_class
::
QUEUE
)
}
it
'skips other enqueued jobs'
do
Sidekiq
::
Testing
.
disable!
do
retry_set
.
schedule
(
1
.
hour
.
from_now
,
payload
)
scheduled_set
.
schedule
(
1
.
hour
.
from_now
,
payload
)
Sidekiq
::
Client
.
push
(
queue_payload
)
expect
{
migration
.
up
}.
not_to
change
{
Sidekiq
::
Queue
.
new
(
described_class
::
QUEUE
).
size
}
expect
(
retry_set
.
size
).
to
eq
(
1
)
expect
(
scheduled_set
.
size
).
to
eq
(
1
)
end
end
end
context
'other queues'
do
it
'does not modify them'
do
Sidekiq
::
Testing
.
disable!
do
Sidekiq
::
Client
.
push
(
'queue'
=>
'other'
,
'class'
=>
::
BackgroundMigrationWorker
,
'args'
=>
[
'SomeOtherClass'
,
1
])
Sidekiq
::
Client
.
push
(
'queue'
=>
'other'
,
'class'
=>
::
BackgroundMigrationWorker
,
'args'
=>
[
described_class
::
DROPPED_JOB_CLASS
,
1
])
expect
{
migration
.
up
}.
not_to
change
{
Sidekiq
::
Queue
.
new
(
'other'
).
size
}
end
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