1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Remove deprecated worker reference. (#5565)

* Remove deprecated worker reference.

* fix build
This commit is contained in:
Abdelkader Boudih 2022-10-08 23:36:53 +01:00 committed by GitHub
parent ae3f6c71fe
commit 936846ad70
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 23 additions and 23 deletions

View file

@ -19,7 +19,7 @@ x = Sidekiq.configure_embed do |config|
end end
class LoadWorker class LoadWorker
include Sidekiq::Worker include Sidekiq::Job
sidekiq_options retry: 1 sidekiq_options retry: 1
sidekiq_retry_in do |x| sidekiq_retry_in do |x|
1 1

View file

@ -211,7 +211,7 @@ module Sidekiq
# #
# You can also clear and drain all job types: # You can also clear and drain all job types:
# #
# Sidekiq::Worker.clear_all # or .drain_all # Sidekiq::Job.clear_all # or .drain_all
# #
# This can be useful to make sure jobs don't linger between tests: # This can be useful to make sure jobs don't linger between tests:
# #

View file

@ -1,4 +1,4 @@
require "sidekiq/job" # frozen_string_literal: true
module Sidekiq module Sidekiq
# Sidekiq::Job is a new alias for Sidekiq::Worker as of Sidekiq 6.3.0. # Sidekiq::Job is a new alias for Sidekiq::Worker as of Sidekiq 6.3.0.

View file

@ -1,5 +1,5 @@
class ExitWorker class ExitWorker
include Sidekiq::Worker include Sidekiq::Job
def perform def perform
logger.warn "Success" logger.warn "Success"

View file

@ -1,5 +1,5 @@
class HardWorker class HardWorker
include Sidekiq::Worker include Sidekiq::Job
sidekiq_options backtrace: 5 sidekiq_options backtrace: 5
def perform(name, count, salt) def perform(name, count, salt)

View file

@ -1,5 +1,5 @@
class LazyWorker class LazyWorker
include Sidekiq::Worker include Sidekiq::Job
def perform def perform
end end

View file

@ -17,14 +17,14 @@ Sidekiq.configure_server do |config|
end end
class EmptyWorker class EmptyWorker
include Sidekiq::Worker include Sidekiq::Job
def perform def perform
end end
end end
class TimedWorker class TimedWorker
include Sidekiq::Worker include Sidekiq::Job
def perform(start) def perform(start)
now = Time.now.to_f now = Time.now.to_f

View file

@ -502,7 +502,7 @@ describe Sidekiq::Client do
describe "class attribute race conditions" do describe "class attribute race conditions" do
new_class = -> { new_class = -> {
Class.new do Class.new do
class_eval("include Sidekiq::Worker", __FILE__, __LINE__) class_eval("include Sidekiq::Job", __FILE__, __LINE__)
define_method(:foo) { get_sidekiq_options } define_method(:foo) { get_sidekiq_options }
end end

View file

@ -20,7 +20,7 @@ end
class CustomWorker class CustomWorker
$recorder = [] $recorder = []
include Sidekiq::Worker include Sidekiq::Job
def perform(recorder) def perform(recorder)
$recorder << ["work_performed"] $recorder << ["work_performed"]
end end

View file

@ -10,7 +10,7 @@ TestProcessorException = Class.new(StandardError)
TEST_PROC_EXCEPTION = TestProcessorException.new("kerboom!") TEST_PROC_EXCEPTION = TestProcessorException.new("kerboom!")
class MockWorker class MockWorker
include Sidekiq::Worker include Sidekiq::Job
def perform(args) def perform(args)
raise TEST_PROC_EXCEPTION if args.to_s == "boom" raise TEST_PROC_EXCEPTION if args.to_s == "boom"
args.pop if args.is_a? Array args.pop if args.is_a? Array

View file

@ -17,7 +17,7 @@ class BadErrorMessage < StandardError
end end
class CustomWorkerWithoutException class CustomWorkerWithoutException
include Sidekiq::Worker include Sidekiq::Job
sidekiq_retry_in do |count| sidekiq_retry_in do |count|
count * 2 count * 2
@ -28,7 +28,7 @@ class SpecialError < StandardError
end end
class CustomWorkerWithException class CustomWorkerWithException
include Sidekiq::Worker include Sidekiq::Job
sidekiq_retry_in do |count, exception| sidekiq_retry_in do |count, exception|
case exception case exception
@ -47,7 +47,7 @@ class CustomWorkerWithException
end end
class ErrorWorker class ErrorWorker
include Sidekiq::Worker include Sidekiq::Job
sidekiq_retry_in do |count| sidekiq_retry_in do |count|
count / 0 count / 0

View file

@ -179,7 +179,7 @@ describe "Sidekiq::Testing.fake" do
end end
it "clears jobs across all workers" do it "clears jobs across all workers" do
Sidekiq::Worker.jobs.clear Sidekiq::Job.jobs.clear
FirstWorker.count = 0 FirstWorker.count = 0
SecondWorker.count = 0 SecondWorker.count = 0
@ -192,7 +192,7 @@ describe "Sidekiq::Testing.fake" do
assert_equal 1, FirstWorker.jobs.size assert_equal 1, FirstWorker.jobs.size
assert_equal 1, SecondWorker.jobs.size assert_equal 1, SecondWorker.jobs.size
Sidekiq::Worker.clear_all Sidekiq::Job.clear_all
assert_equal 0, FirstWorker.jobs.size assert_equal 0, FirstWorker.jobs.size
assert_equal 0, SecondWorker.jobs.size assert_equal 0, SecondWorker.jobs.size
@ -202,7 +202,7 @@ describe "Sidekiq::Testing.fake" do
end end
it "drains jobs across all workers" do it "drains jobs across all workers" do
Sidekiq::Worker.jobs.clear Sidekiq::Job.jobs.clear
FirstWorker.count = 0 FirstWorker.count = 0
SecondWorker.count = 0 SecondWorker.count = 0
@ -218,7 +218,7 @@ describe "Sidekiq::Testing.fake" do
assert_equal 1, FirstWorker.jobs.size assert_equal 1, FirstWorker.jobs.size
assert_equal 1, SecondWorker.jobs.size assert_equal 1, SecondWorker.jobs.size
Sidekiq::Worker.drain_all Sidekiq::Job.drain_all
assert_equal 0, FirstWorker.jobs.size assert_equal 0, FirstWorker.jobs.size
assert_equal 0, SecondWorker.jobs.size assert_equal 0, SecondWorker.jobs.size
@ -240,7 +240,7 @@ describe "Sidekiq::Testing.fake" do
end end
it "drains jobs across all workers even when workers create new jobs" do it "drains jobs across all workers even when workers create new jobs" do
Sidekiq::Worker.jobs.clear Sidekiq::Job.jobs.clear
FirstWorker.count = 0 FirstWorker.count = 0
SecondWorker.count = 0 SecondWorker.count = 0
@ -253,7 +253,7 @@ describe "Sidekiq::Testing.fake" do
assert_equal 1, ThirdWorker.jobs.size assert_equal 1, ThirdWorker.jobs.size
Sidekiq::Worker.drain_all Sidekiq::Job.drain_all
assert_equal 0, ThirdWorker.jobs.size assert_equal 0, ThirdWorker.jobs.size
@ -262,12 +262,12 @@ describe "Sidekiq::Testing.fake" do
end end
it "drains jobs of workers with symbolized queue names" do it "drains jobs of workers with symbolized queue names" do
Sidekiq::Worker.jobs.clear Sidekiq::Job.jobs.clear
AltQueueWorker.perform_async(5, 6) AltQueueWorker.perform_async(5, 6)
assert_equal 1, AltQueueWorker.jobs.size assert_equal 1, AltQueueWorker.jobs.size
Sidekiq::Worker.drain_all Sidekiq::Job.drain_all
assert_equal 0, AltQueueWorker.jobs.size assert_equal 0, AltQueueWorker.jobs.size
end end

View file

@ -5,7 +5,7 @@ require "sidekiq/web"
require "rack/test" require "rack/test"
class WebWorker class WebWorker
include Sidekiq::Worker include Sidekiq::Job
def perform(a, b) def perform(a, b)
a + b a + b