perfectsched 0.7.8 → 0.7.9
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +10 -0
- data/lib/perfectsched/backend/rdb.rb +1 -1
- data/lib/perfectsched/backend/simpledb.rb +2 -1
- data/lib/perfectsched/backend.rb +1 -1
- data/lib/perfectsched/version.rb +1 -1
- data/test/backend_test.rb +8 -4
- metadata +12 -12
data/ChangeLog
CHANGED
@@ -101,7 +101,7 @@ class RDBBackend < Backend
|
|
101
101
|
def get(id)
|
102
102
|
connect {
|
103
103
|
@db.fetch("SELECT id, timeout, next_time, cron, delay, data, timezone FROM `#{@table}` WHERE id=?;", id) {|row|
|
104
|
-
return row[:cron], row[:delay], row[:data], row[:timezone]
|
104
|
+
return row[:cron], row[:delay], row[:data], row[:timezone], row[:next_time]
|
105
105
|
}
|
106
106
|
return nil
|
107
107
|
}
|
@@ -131,7 +131,8 @@ class SimpleDBBackend < Backend
|
|
131
131
|
delay = int_decode(attrs['delay'].first)
|
132
132
|
data = attrs['data'].first
|
133
133
|
timezone = attrs['timezone'].first
|
134
|
-
|
134
|
+
next_time = int_decode(attrs['next_time'].first)
|
135
|
+
return cron, delay, data, timezone, next_time
|
135
136
|
end
|
136
137
|
|
137
138
|
def modify_checked(id, cron, delay, data, timezone)
|
data/lib/perfectsched/backend.rb
CHANGED
@@ -61,7 +61,7 @@ class Backend
|
|
61
61
|
|
62
62
|
# => true (success) or false (not found)
|
63
63
|
def modify_sched(id, cron, delay)
|
64
|
-
cron_, delay_, data_, timezone = get(id)
|
64
|
+
cron_, delay_, data_, timezone, next_time = get(id)
|
65
65
|
cron = cron.strip
|
66
66
|
@croncalc.next_time(cron, 0, timezone)
|
67
67
|
modify_sched_checked(id, cron, delay)
|
data/lib/perfectsched/version.rb
CHANGED
data/test/backend_test.rb
CHANGED
@@ -157,34 +157,38 @@ class BackendTest < Test::Unit::TestCase
|
|
157
157
|
ok = db1.add(key, "* * * * *", 0, 'data1', time)
|
158
158
|
assert_equal true, ok
|
159
159
|
|
160
|
-
cron, delay, data = db1.get(key)
|
160
|
+
cron, delay, data, timezone, next_time = db1.get(key)
|
161
161
|
assert_equal "* * * * *", cron
|
162
162
|
assert_equal 0, delay
|
163
163
|
assert_equal 'data1', data
|
164
|
+
assert_equal time+60, next_time
|
164
165
|
|
165
166
|
ok = db1.modify_sched(key, "* * * * 1", 10)
|
166
167
|
assert_equal true, ok
|
167
168
|
|
168
|
-
cron, delay, data = db1.get(key)
|
169
|
+
cron, delay, data, timezone, next_time = db1.get(key)
|
169
170
|
assert_equal "* * * * 1", cron
|
170
171
|
assert_equal 10, delay
|
171
172
|
assert_equal 'data1', data
|
173
|
+
assert_equal time+60, next_time
|
172
174
|
|
173
175
|
ok = db1.modify_data(key, "data2")
|
174
176
|
assert_equal true, ok
|
175
177
|
|
176
|
-
cron, delay, data = db1.get(key)
|
178
|
+
cron, delay, data, timezone, next_time = db1.get(key)
|
177
179
|
assert_equal "* * * * 1", cron
|
178
180
|
assert_equal 10, delay
|
179
181
|
assert_equal 'data2', data
|
182
|
+
assert_equal time+60, next_time
|
180
183
|
|
181
184
|
ok = db1.modify(key, "* * * * 2", 20, "data3", nil)
|
182
185
|
assert_equal true, ok
|
183
186
|
|
184
|
-
cron, delay, data = db1.get(key)
|
187
|
+
cron, delay, data, timezone, next_time = db1.get(key)
|
185
188
|
assert_equal "* * * * 2", cron
|
186
189
|
assert_equal 20, delay
|
187
190
|
assert_equal 'data3', data
|
191
|
+
assert_equal time+60, next_time
|
188
192
|
end
|
189
193
|
|
190
194
|
it 'timezone' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: perfectsched
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-02-10 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cron-spec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70100607445380 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - <=
|
@@ -24,10 +24,10 @@ dependencies:
|
|
24
24
|
version: 0.1.2
|
25
25
|
type: :runtime
|
26
26
|
prerelease: false
|
27
|
-
version_requirements: *
|
27
|
+
version_requirements: *70100607445380
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: sequel
|
30
|
-
requirement: &
|
30
|
+
requirement: &70100607444640 !ruby/object:Gem::Requirement
|
31
31
|
none: false
|
32
32
|
requirements:
|
33
33
|
- - ~>
|
@@ -35,10 +35,10 @@ dependencies:
|
|
35
35
|
version: 3.26.0
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
|
-
version_requirements: *
|
38
|
+
version_requirements: *70100607444640
|
39
39
|
- !ruby/object:Gem::Dependency
|
40
40
|
name: aws-sdk
|
41
|
-
requirement: &
|
41
|
+
requirement: &70100607444160 !ruby/object:Gem::Requirement
|
42
42
|
none: false
|
43
43
|
requirements:
|
44
44
|
- - ~>
|
@@ -46,10 +46,10 @@ dependencies:
|
|
46
46
|
version: 1.1.1
|
47
47
|
type: :runtime
|
48
48
|
prerelease: false
|
49
|
-
version_requirements: *
|
49
|
+
version_requirements: *70100607444160
|
50
50
|
- !ruby/object:Gem::Dependency
|
51
51
|
name: perfectqueue
|
52
|
-
requirement: &
|
52
|
+
requirement: &70100607443680 !ruby/object:Gem::Requirement
|
53
53
|
none: false
|
54
54
|
requirements:
|
55
55
|
- - ~>
|
@@ -57,10 +57,10 @@ dependencies:
|
|
57
57
|
version: 0.7.0
|
58
58
|
type: :runtime
|
59
59
|
prerelease: false
|
60
|
-
version_requirements: *
|
60
|
+
version_requirements: *70100607443680
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: tzinfo
|
63
|
-
requirement: &
|
63
|
+
requirement: &70100607443200 !ruby/object:Gem::Requirement
|
64
64
|
none: false
|
65
65
|
requirements:
|
66
66
|
- - ~>
|
@@ -68,7 +68,7 @@ dependencies:
|
|
68
68
|
version: 0.3.29
|
69
69
|
type: :runtime
|
70
70
|
prerelease: false
|
71
|
-
version_requirements: *
|
71
|
+
version_requirements: *70100607443200
|
72
72
|
description:
|
73
73
|
email: frsyuki@gmail.com
|
74
74
|
executables:
|