say_when 0.2.3 → 0.2.4
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.
@@ -19,28 +19,28 @@ module SayWhen #:nodoc:
|
|
19
19
|
|
20
20
|
def schedule_instance(next_at_method, job={})
|
21
21
|
options = job_options(job)
|
22
|
-
options[:trigger_strategy] =
|
22
|
+
options[:trigger_strategy] = 'instance'
|
23
23
|
options[:trigger_options] = {:next_at_method => next_at_method}
|
24
24
|
Scheduler.schedule(options)
|
25
25
|
end
|
26
26
|
|
27
27
|
def schedule_cron(expression, time_zone, job={})
|
28
28
|
options = job_options(job)
|
29
|
-
options[:trigger_strategy] =
|
29
|
+
options[:trigger_strategy] = 'cron'
|
30
30
|
options[:trigger_options] = {:expression => expression, :time_zone => time_zone}
|
31
31
|
Scheduler.schedule(options)
|
32
32
|
end
|
33
33
|
|
34
34
|
def schedule_once(time, job={})
|
35
35
|
options = job_options(job)
|
36
|
-
options[:trigger_strategy] =
|
36
|
+
options[:trigger_strategy] = 'once'
|
37
37
|
options[:trigger_options] = {:at => time}
|
38
38
|
Scheduler.schedule(options)
|
39
39
|
end
|
40
40
|
|
41
41
|
def schedule_in(after, job={})
|
42
42
|
options = job_options(job)
|
43
|
-
options[:trigger_strategy] =
|
43
|
+
options[:trigger_strategy] = 'once'
|
44
44
|
options[:trigger_options] = {:at => (Time.now + after)}
|
45
45
|
Scheduler.schedule(options)
|
46
46
|
end
|
@@ -18,6 +18,7 @@ module SayWhen
|
|
18
18
|
serialize :data
|
19
19
|
belongs_to :scheduled, :polymorphic => true
|
20
20
|
has_many :job_executions, :class_name=>'SayWhen::Storage::ActiveRecord::JobExecution'
|
21
|
+
before_create :set_defaults
|
21
22
|
|
22
23
|
def self.acquire_next(no_later_than)
|
23
24
|
SayWhen::Storage::ActiveRecord::Job.transaction do
|
@@ -39,12 +40,13 @@ module SayWhen
|
|
39
40
|
end
|
40
41
|
end
|
41
42
|
|
42
|
-
def
|
43
|
+
def set_defaults
|
44
|
+
# puts "SayWhen::Storage::ActiveRecord::Job - set_defaults start"
|
43
45
|
self.status = STATE_WAITING
|
44
46
|
self.next_fire_at = self.trigger.next_fire_at
|
47
|
+
# puts "SayWhen::Storage::ActiveRecord::Job - set_defaults, next_fire_at: #{self.next_fire_at}"
|
45
48
|
end
|
46
49
|
|
47
|
-
|
48
50
|
def fired(fired_at=Time.now)
|
49
51
|
Job.transaction {
|
50
52
|
super
|
data/lib/say_when/version.rb
CHANGED
data/spec/db/test.db
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: say_when
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 4
|
10
|
+
version: 0.2.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andrew Kuklewicz
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-10-
|
18
|
+
date: 2012-10-09 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: activemessaging
|