Skip to content

Commit

Permalink
avoid "can't be called from trap context" Ruby 2.0
Browse files Browse the repository at this point in the history
closes gh-98
  • Loading branch information
jmettraux committed Feb 13, 2014
1 parent ac58ebb commit ceb833b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
= rufus-scheduler CHANGELOG.txt


== rufus-scheduler - 3.0.6 not yet released

- avoid "can't be called from trap context" on Ruby 2.0, gh-98


== rufus-scheduler - 3.0.5 released 2014/01/30

- implement Job#call(do_rescue=false), gh-97
Expand Down
4 changes: 3 additions & 1 deletion lib/rufus/scheduler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ def shutdown(opt=nil)

@started_at = nil

jobs.each { |j| j.unschedule }
#jobs.each { |j| j.unschedule }
# provokes https://github.com/jmettraux/rufus-scheduler/issue/98
@jobs.array.each { |j| j.unschedule }

@work_queue.clear

Expand Down
7 changes: 7 additions & 0 deletions lib/rufus/scheduler/job_array.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ def [](job_id)

@mutex.synchronize { @array.find { |j| j.job_id == job_id } }
end

# Only used when shutting down, directly yields the underlying array.
#
def array

@array
end
end
end
end
Expand Down

0 comments on commit ceb833b

Please sign in to comment.