sidekiq-cron 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/sidekiq/cron/job.rb +8 -1
- data/sidekiq-cron.gemspec +2 -2
- data/test/unit/job_test.rb +17 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c90d24def3eade7024094a7566884c40f1cd8ae6
|
4
|
+
data.tar.gz: e8b4b9db953ef8044064c680faff48cc315fd5e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39e8b2497e40539f2f3d94c415a8dc6f4b7f1b852a3876fed743eb2c63b5c2defb1c24404d076cdb837d619125820a9eb60d374831886a81d57a056f649edf8f
|
7
|
+
data.tar.gz: 1ebaa7c1b9bd7fd950a7e30bfae464ebfc2ff064ab97010f6bc0efa74fd00bd297f91254ba4329b0aa2139d97f985acaa73749efc1cd14e74190d5312fdd2c6e
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.2
|
data/lib/sidekiq/cron/job.rb
CHANGED
@@ -47,7 +47,14 @@ module Sidekiq
|
|
47
47
|
def enque! time = Time.now
|
48
48
|
@last_enqueue_time = time
|
49
49
|
|
50
|
-
|
50
|
+
klass_const =
|
51
|
+
begin
|
52
|
+
@klass.to_s.constantize
|
53
|
+
rescue NameError
|
54
|
+
nil
|
55
|
+
end
|
56
|
+
|
57
|
+
if @active_job or defined?(ActiveJob::Base) && klass_const && klass_const < ActiveJob::Base
|
51
58
|
Sidekiq::Client.push(active_job_message)
|
52
59
|
else
|
53
60
|
Sidekiq::Client.push(sidekiq_worker_message)
|
data/sidekiq-cron.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: sidekiq-cron 0.4.
|
5
|
+
# stub: sidekiq-cron 0.4.2 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "sidekiq-cron"
|
9
|
-
s.version = "0.4.
|
9
|
+
s.version = "0.4.2"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
data/test/unit/job_test.rb
CHANGED
@@ -513,6 +513,23 @@ describe "Cron Job" do
|
|
513
513
|
@job.enque!
|
514
514
|
end
|
515
515
|
end
|
516
|
+
|
517
|
+
describe 'sidekiq worker unknown class' do
|
518
|
+
before do
|
519
|
+
@args = {
|
520
|
+
name: 'Test',
|
521
|
+
cron: '* * * * *',
|
522
|
+
klass: 'UnknownClass',
|
523
|
+
queue: 'another'
|
524
|
+
}
|
525
|
+
@job = Sidekiq::Cron::Job.new(@args)
|
526
|
+
end
|
527
|
+
|
528
|
+
it 'pushes to queue sidekiq worker message' do
|
529
|
+
assert_equal @job.sidekiq_worker_message, { 'class' => 'UnknownClass', 'args' => [], 'queue' => 'another' }
|
530
|
+
@job.enque!
|
531
|
+
end
|
532
|
+
end
|
516
533
|
end
|
517
534
|
|
518
535
|
describe "save" do
|