@@ -401,7 +401,7 @@ def scheduled_redis_item_and_score
401
401
402
402
item , score = scheduled_redis_item_and_score
403
403
expect ( JSON . parse ( item ) ) . to include ( "class" => "ThrottledTestJob" , "args" => [ 1 ] ,
404
- "queue" => "queue: default" )
404
+ "queue" => "default" )
405
405
expect ( score . to_f ) . to be_within ( 31.0 ) . of ( Time . now . to_f + 330.0 )
406
406
407
407
# Ensure that the job is no longer in the private queue
@@ -425,7 +425,7 @@ def scheduled_redis_item_and_score
425
425
426
426
item , score = scheduled_redis_item_and_score
427
427
expect ( JSON . parse ( item ) ) . to include ( "class" => "ThrottledTestJob" , "args" => [ 1 ] ,
428
- "queue" => "queue: other_queue" )
428
+ "queue" => "other_queue" )
429
429
expect ( score . to_f ) . to be_within ( 31.0 ) . of ( Time . now . to_f + 330.0 )
430
430
431
431
# Ensure that the job is no longer in the private queue
@@ -449,7 +449,7 @@ def scheduled_redis_item_and_score
449
449
450
450
item , score = scheduled_redis_item_and_score
451
451
expect ( JSON . parse ( item ) ) . to include ( "class" => "ThrottledTestJob" , "args" => [ 1 ] ,
452
- "queue" => "queue: default" )
452
+ "queue" => "default" )
453
453
expect ( score . to_f ) . to be_within ( 31.0 ) . of ( Time . now . to_f + 330.0 )
454
454
455
455
# Ensure that the job is no longer in the private queue
@@ -475,7 +475,7 @@ def scheduled_redis_item_and_score
475
475
476
476
item , score = scheduled_redis_item_and_score
477
477
expect ( JSON . parse ( item ) ) . to include ( "class" => "ThrottledTestJob" , "args" => [ 1 ] ,
478
- "queue" => "queue: other_queue" )
478
+ "queue" => "other_queue" )
479
479
expect ( score . to_f ) . to be_within ( 31.0 ) . of ( Time . now . to_f + 330.0 )
480
480
481
481
# Ensure that the job is no longer in the private queue
@@ -503,7 +503,7 @@ def scheduled_redis_item_and_score
503
503
504
504
item , score = scheduled_redis_item_and_score
505
505
expect ( JSON . parse ( item ) ) . to include ( "class" => "ThrottledTestJob" , "args" => [ 1 ] ,
506
- "queue" => "queue: default" )
506
+ "queue" => "default" )
507
507
expect ( score . to_f ) . to be_within ( 31.0 ) . of ( Time . now . to_f + 330.0 )
508
508
509
509
# Ensure that the job is no longer in the private queue
@@ -531,7 +531,7 @@ def scheduled_redis_item_and_score
531
531
532
532
item , score = scheduled_redis_item_and_score
533
533
expect ( JSON . parse ( item ) ) . to include ( "class" => "ThrottledTestJob" , "args" => [ 1 ] ,
534
- "queue" => "queue: default" )
534
+ "queue" => "default" )
535
535
expect ( score . to_f ) . to be_within ( 51.0 ) . of ( Time . now . to_f + 550.0 )
536
536
537
537
# Ensure that the job is no longer in the private queue
@@ -666,7 +666,17 @@ def scheduled_redis_item_and_score
666
666
it "returns false and does not reschedule the job" do
667
667
expect ( Sidekiq ::Client ) . not_to receive ( :enqueue_to_in )
668
668
expect ( work ) . not_to receive ( :acknowledge )
669
- expect ( subject . send ( :reschedule_throttled , work , requeue_to : "queue:default" ) ) . to be_falsey
669
+ expect ( subject . send ( :reschedule_throttled , work , "queue:default" ) ) . to be_falsey
670
+ end
671
+ end
672
+
673
+ context "when target_queue has the 'queue:' prefix" do
674
+ let ( :target_queue ) { "queue:default" }
675
+
676
+ it "reschedules the job to the specified queue" do
677
+ expect ( Sidekiq ::Client ) . to receive ( :enqueue_to_in ) . with ( "default" , anything , anything , anything )
678
+ expect ( work ) . to receive ( :acknowledge )
679
+ subject . send ( :reschedule_throttled , work , target_queue )
670
680
end
671
681
end
672
682
end
@@ -807,7 +817,7 @@ def scheduled_redis_item_and_score
807
817
808
818
item , score = scheduled_redis_item_and_score
809
819
expect ( JSON . parse ( item ) ) . to include ( "class" => "ThrottledTestJob" , "args" => [ 1 ] ,
810
- "queue" => "queue: default" )
820
+ "queue" => "default" )
811
821
expect ( score . to_f ) . to be_within ( 31.0 ) . of ( Time . now . to_f + 330.0 )
812
822
end
813
823
end
@@ -823,7 +833,7 @@ def scheduled_redis_item_and_score
823
833
824
834
item , score = scheduled_redis_item_and_score
825
835
expect ( JSON . parse ( item ) ) . to include ( "class" => "ThrottledTestJob" , "args" => [ 1 ] ,
826
- "queue" => "queue: other_queue" )
836
+ "queue" => "other_queue" )
827
837
expect ( score . to_f ) . to be_within ( 31.0 ) . of ( Time . now . to_f + 330.0 )
828
838
end
829
839
end
@@ -839,7 +849,7 @@ def scheduled_redis_item_and_score
839
849
840
850
item , score = scheduled_redis_item_and_score
841
851
expect ( JSON . parse ( item ) ) . to include ( "class" => "ThrottledTestJob" , "args" => [ 1 ] ,
842
- "queue" => "queue: default" )
852
+ "queue" => "default" )
843
853
expect ( score . to_f ) . to be_within ( 31.0 ) . of ( Time . now . to_f + 330.0 )
844
854
end
845
855
end
@@ -859,7 +869,7 @@ def scheduled_redis_item_and_score
859
869
860
870
item , score = scheduled_redis_item_and_score
861
871
expect ( JSON . parse ( item ) ) . to include ( "class" => "ThrottledTestJob" , "args" => [ 1 ] ,
862
- "queue" => "queue: other_queue" )
872
+ "queue" => "other_queue" )
863
873
expect ( score . to_f ) . to be_within ( 31.0 ) . of ( Time . now . to_f + 330.0 )
864
874
end
865
875
end
@@ -879,7 +889,7 @@ def scheduled_redis_item_and_score
879
889
880
890
item , score = scheduled_redis_item_and_score
881
891
expect ( JSON . parse ( item ) ) . to include ( "class" => "ThrottledTestJob" , "args" => [ 1 ] ,
882
- "queue" => "queue: default" )
892
+ "queue" => "default" )
883
893
expect ( score . to_f ) . to be_within ( 31.0 ) . of ( Time . now . to_f + 330.0 )
884
894
end
885
895
end
@@ -899,7 +909,7 @@ def scheduled_redis_item_and_score
899
909
900
910
item , score = scheduled_redis_item_and_score
901
911
expect ( JSON . parse ( item ) ) . to include ( "class" => "ThrottledTestJob" , "args" => [ 1 ] ,
902
- "queue" => "queue: default" )
912
+ "queue" => "default" )
903
913
expect ( score . to_f ) . to be_within ( 51.0 ) . of ( Time . now . to_f + 550.0 )
904
914
end
905
915
end
@@ -998,7 +1008,17 @@ def scheduled_redis_item_and_score
998
1008
it "returns false and does not reschedule the job" do
999
1009
expect ( Sidekiq ::Client ) . not_to receive ( :enqueue_to_in )
1000
1010
expect ( work ) . not_to receive ( :acknowledge )
1001
- expect ( subject . send ( :reschedule_throttled , work , requeue_to : "queue:default" ) ) . to be_falsey
1011
+ expect ( subject . send ( :reschedule_throttled , work , "queue:default" ) ) . to be_falsey
1012
+ end
1013
+ end
1014
+
1015
+ context "when target_queue has the 'queue:' prefix" do
1016
+ let ( :target_queue ) { "queue:default" }
1017
+
1018
+ it "reschedules the job to the specified queue" do
1019
+ expect ( Sidekiq ::Client ) . to receive ( :enqueue_to_in ) . with ( "default" , anything , anything , anything )
1020
+ expect ( work ) . to receive ( :acknowledge )
1021
+ subject . send ( :reschedule_throttled , work , target_queue )
1002
1022
end
1003
1023
end
1004
1024
end
0 commit comments