scheduler : substantial rewrite

Skip to first unread message

John Mettraux

Jan 7, 2008, 4:50:07 AM1/7/08
Hi guys,

I know some of you here are using the openwferu-scheduler [gem], so
you might be interested by a change I just made.

I came across this blog post :

It details an issue with the scheduler and the change fixed it.

The cause was a bit too much of synchronization (using Monitor). I
discarded the monitor in the scheduler and am I now using two queues

I battled the test cases for a while, they are now all running successfully.

Are they any visible change ?

Not really, the interface is the same (method names everything).
Except for the unschedule methods which now don't return anything
(they used to return true in case of successful unscheduling).

There is one slight hitch : the schedule and unschedule method calls
are now asynchronous, for example :


require 'rubygems'
require 'openwfe/util/scheduler'
include OpenWFE

s =

job_id = s.schedule_in("5h") do
puts "it's time Doc Schweizer"

# then, immediately...



The job will not get unscheduled, because the schedule and unschedule
operations now occur as the scheduler wakes up (by default every 0.250
second). Sleeping for something like 0.300 second before unscheduling
solves the issue.

This has not yet been packaged as a gem, because the bug was reported

If once this change is propagated (packaged in the next
openwferu-scheduler gem), you spot an issue, please report it here or
in OpenWFEru's issue tracker :

Best regards, I wish you all a happy new year,

John Mettraux -///-

Reply all
Reply to author
0 new messages