rufus-scheduler 2.0.22 → 2.0.23

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.txt CHANGED
@@ -2,6 +2,11 @@
2
2
  = rufus-scheduler CHANGELOG.txt
3
3
 
4
4
 
5
+ == rufus-scheduler - 2.0.23 released 2013/07/26
6
+
7
+ - mutex vs timeout fix by Tobias Kraze
8
+
9
+
5
10
  == rufus-scheduler - 2.0.22 released 2013/07/16
6
11
 
7
12
  - parse "/10 * * * *" again (like <= 2.0.19 did), thanks @skrd
data/CREDITS.txt CHANGED
@@ -4,6 +4,7 @@
4
4
 
5
5
  == Contributors
6
6
 
7
+ - Tobias Kraze (https://github.com/kratob) timeout vs mutex fix
7
8
  - Thomas Sevestre (https://github.com/thomassevestre) :exception option
8
9
  - Matteo Cerutti - last_time / previous_time idea (and initial implementation)
9
10
  - Aimee Rose (https://github.com/AimeeRose) cronline and > 24
data/lib/rufus/sc/jobs.rb CHANGED
@@ -186,6 +186,19 @@ module Scheduler
186
186
 
187
187
  @last_job_thread = job_thread
188
188
 
189
+ # note that add_job and add_cron_job ensured that :blocking is
190
+ # not used along :timeout
191
+
192
+ if to = @params[:timeout]
193
+
194
+ to_job = @scheduler.in(to, :parent => self, :tags => 'timeout') do
195
+
196
+ if job_thread && job_thread.alive?
197
+ job_thread.raise(Rufus::Scheduler::TimeOutError)
198
+ end
199
+ end
200
+ end
201
+
189
202
  begin
190
203
 
191
204
  trigger_block
@@ -206,20 +219,6 @@ module Scheduler
206
219
  @running = false
207
220
  end
208
221
 
209
- # note that add_job and add_cron_job ensured that :blocking is
210
- # not used along :timeout
211
-
212
- if to = @params[:timeout]
213
-
214
- to_job = @scheduler.in(to, :parent => self, :tags => 'timeout') do
215
-
216
- # at this point, @job_thread might be set
217
-
218
- if job_thread && job_thread.alive?
219
- job_thread.raise(Rufus::Scheduler::TimeOutError)
220
- end
221
- end
222
- end
223
222
  end
224
223
 
225
224
  # Simply encapsulating the block#call/trigger operation, for easy
@@ -26,7 +26,7 @@
26
26
  module Rufus
27
27
  module Scheduler
28
28
 
29
- VERSION = '2.0.22'
29
+ VERSION = '2.0.23'
30
30
  end
31
31
  end
32
32
 
data/spec/timeout_spec.rb CHANGED
@@ -121,5 +121,28 @@ describe "#{SCHEDULER_CLASS} timeouts" do
121
121
 
122
122
  @s.jobs.size.should == 0
123
123
  end
124
+
125
+ it 'times out properly after waiting for a mutex' do
126
+
127
+ mutex = Mutex.new
128
+ timedout = false
129
+
130
+ @s.in '0s', :mutex => mutex do
131
+ sleep 1
132
+ end
133
+
134
+ @s.in '0s', :mutex => mutex, :timeout => 0.1 do
135
+ begin
136
+ sleep 2
137
+ rescue Rufus::Scheduler::TimeOutError => e
138
+ timedout = true
139
+ end
140
+ end
141
+
142
+ sleep 2
143
+
144
+ @s.jobs.size.should == 0
145
+ timedout.should be_true
146
+ end
124
147
  end
125
148
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rufus-scheduler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.22
4
+ version: 2.0.23
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-16 00:00:00.000000000 Z
12
+ date: 2013-07-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: tzinfo
@@ -113,12 +113,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
113
113
  - - ! '>='
114
114
  - !ruby/object:Gem::Version
115
115
  version: '0'
116
+ segments:
117
+ - 0
118
+ hash: 4294250464389651443
116
119
  required_rubygems_version: !ruby/object:Gem::Requirement
117
120
  none: false
118
121
  requirements:
119
122
  - - ! '>='
120
123
  - !ruby/object:Gem::Version
121
124
  version: '0'
125
+ segments:
126
+ - 0
127
+ hash: 4294250464389651443
122
128
  requirements: []
123
129
  rubyforge_project: rufus
124
130
  rubygems_version: 1.8.23