Skip to content

Commit

Permalink
Make CheckWorker CheckJob
Browse files Browse the repository at this point in the history
Sidekiq workers are no longer supported
  • Loading branch information
JonathanHallam committed Sep 26, 2024
1 parent d9fc8e3 commit 9920f80
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/controllers/batch_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def create
render(json: batch_report(batch), status: :created)
else
batch.checks.each do |check|
CheckWorker.run(check.id, priority: create_params.priority)
CheckJob.run(check.id, priority: create_params.priority)
end

render(json: batch_report(batch.reload), status: :accepted)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/check_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def check

check = Check.create!(link:)

CheckWorker.run(
CheckJob.run(
check.id,
priority: check_params.priority,
synchronous: check_params.synchronous,
Expand Down
4 changes: 2 additions & 2 deletions app/workers/check_worker.rb → app/workers/check_job.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class CheckWorker
include Sidekiq::Worker
class CheckJob
include Sidekiq::Job
include PerformAsyncInQueue

sidekiq_options retry: 3, lock: :until_and_while_executing, lock_args_method: :unique_args
Expand Down
2 changes: 1 addition & 1 deletion app/workers/cleanup_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class CleanupWorker

def perform
checks_to_perform.each do |check_id|
CheckWorker.perform_async(check_id)
CheckJob.perform_async(check_id)
end

old_batches.delete_all
Expand Down
2 changes: 1 addition & 1 deletion spec/requests/batch_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
include_examples "returns batch report"

it "creates a job" do
expect(CheckWorker.jobs.size).to eq(2)
expect(CheckJob.jobs.size).to eq(2)
end
end

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "rails_helper"

RSpec.describe CheckWorker do
RSpec.describe CheckJob do
specify { expect(described_class).to have_valid_sidekiq_options }

describe "perform" do
Expand Down

0 comments on commit 9920f80

Please sign in to comment.