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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 873586d3842f9498012e042967394936f59ff000
4
- data.tar.gz: 455f2a83bca498a0b0b6d37c4a9dd359170a6f28
3
+ metadata.gz: c90d24def3eade7024094a7566884c40f1cd8ae6
4
+ data.tar.gz: e8b4b9db953ef8044064c680faff48cc315fd5e4
5
5
  SHA512:
6
- metadata.gz: 6eba0a3a0270f83abb155ac4683d03aa06f30e8d801c0b242e627dc29cd04d646f1e7d91c5a45da9b1197e8dd968d09e88fa4df3161cc216e3d097e7a319c036
7
- data.tar.gz: 7776ad92e891399343e16020e2fb7136e472614fdc7a9503910e48bffe5e1a442456cf1785bd885d1c808a24d77f8e28ea058bc6a299b51eb0f486f7b98d4f15
6
+ metadata.gz: 39e8b2497e40539f2f3d94c415a8dc6f4b7f1b852a3876fed743eb2c63b5c2defb1c24404d076cdb837d619125820a9eb60d374831886a81d57a056f649edf8f
7
+ data.tar.gz: 1ebaa7c1b9bd7fd950a7e30bfae464ebfc2ff064ab97010f6bc0efa74fd00bd297f91254ba4329b0aa2139d97f985acaa73749efc1cd14e74190d5312fdd2c6e
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.4.2
@@ -47,7 +47,14 @@ module Sidekiq
47
47
  def enque! time = Time.now
48
48
  @last_enqueue_time = time
49
49
 
50
- if @active_job or defined?(ActiveJob::Base) && @klass.to_s.constantize < ActiveJob::Base
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)
@@ -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.1 ruby lib
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.1"
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"]
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-cron
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ondrej Bartas