resque-scheduler 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/HISTORY.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## 1.0.5 (2010-03-01)
2
+
3
+ * Fixed support for overriding queue from schedule config.
4
+ * Removed resque-web dependency on loading the job classes for "Queue Now",
5
+ provided "queue" is specified in the schedule.
6
+ * The queue is now stored with the job and arguments in the delayed queue so
7
+ there is no longer a need for the scheduler to load job classes to introspect
8
+ the queue.
9
+
1
10
  ## 1.0.4 (2010-02-26)
2
11
 
3
12
  * Added support for specifying the queue to put the job onto. This allows for
data/README.markdown CHANGED
@@ -37,7 +37,7 @@ queue is given it is not necessary for the scheduler to load the class.
37
37
  clear_leaderboards_moderator:
38
38
  cron: "30 6 * * 1"
39
39
  class: ClearLeaderboards
40
- queue: scoring
40
+ queue: scoring
41
41
  args: moderators
42
42
  description: "This job resets the weekly leaderboard for moderators"
43
43
 
@@ -71,8 +71,8 @@ module Resque
71
71
  handle_shutdown do
72
72
  if item = Resque.next_item_for_timestamp(timestamp)
73
73
  log "queuing #{item['class']} [delayed]"
74
- klass = constantize(item['class'])
75
- Resque.enqueue(klass, *item['args'])
74
+ queue = item['queue'] || queue_from_class(constantize(item['class']))
75
+ Job.create(queue, item['class'], *item['args'])
76
76
  end
77
77
  end
78
78
  # continue processing until there are no more ready items in this timestamp
@@ -38,7 +38,7 @@ module ResqueScheduler
38
38
  # for queueing. Until timestamp is in the past, the job will
39
39
  # sit in the schedule list.
40
40
  def enqueue_at(timestamp, klass, *args)
41
- delayed_push(timestamp, :class => klass.to_s, :args => args)
41
+ delayed_push(timestamp, :class => klass.to_s, :args => args, :queue => queue_from_class(klass))
42
42
  end
43
43
 
44
44
  # Identical to enqueue_at but takes number_of_seconds_from_now
@@ -1,3 +1,3 @@
1
1
  module ResqueScheduler
2
- Version = '1.0.4'
2
+ Version = '1.0.5'
3
3
  end
@@ -98,7 +98,7 @@ class Resque::DelayedQueueTest < Test::Unit::TestCase
98
98
  assert_equal(1, Resque.delayed_timestamp_peek(t, 0, 1).length)
99
99
  assert_equal(2, Resque.delayed_timestamp_peek(t, 0, 3).length)
100
100
 
101
- assert_equal({'args' => [], 'class' => 'SomeIvarJob'}, Resque.delayed_timestamp_peek(t, 0, 1).first)
101
+ assert_equal({'args' => [], 'class' => 'SomeIvarJob', 'queue' => 'ivar'}, Resque.delayed_timestamp_peek(t, 0, 1).first)
102
102
  end
103
103
 
104
104
  def test_handle_delayed_items_with_no_items
@@ -110,7 +110,10 @@ class Resque::DelayedQueueTest < Test::Unit::TestCase
110
110
  t = Time.now - 60 # in the past
111
111
  Resque.enqueue_at(t, SomeIvarJob)
112
112
  Resque.enqueue_at(t, SomeIvarJob)
113
- Resque.expects(:enqueue).twice
113
+
114
+ # 2 SomeIvarJob jobs should be created in the "ivar" queue
115
+ Resque::Job.expects(:create).twice.with('ivar', 'SomeIvarJob')
116
+ Resque::Scheduler.expects(:queue_from_class).never # Should NOT need to load the class
114
117
  Resque::Scheduler.handle_delayed_items
115
118
  end
116
119
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-scheduler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben VandenBos