Hi!
I've got a problem with persistence (or rather lack of thereof) of
code blocks passed to scheduler's schedule_in method.
I'm initializing a scheduler global in environment.rb:
require 'rubygems'
require 'time'
require 'openwfe/util/scheduler'
include OpenWFE
$scheduler = Scheduler.new
$scheduler.start
I'm at the testing&discovery level of OpenWFEru, so I wrote a
controller which in "start" action generates and schedules some jobs
to execute:
0.upto(4) do |i|
$jobs[i] = $scheduler.schedule_in (rand(10) + 5)
{ NotifMailer.deliver_notify() }
end
And other action in same controller which, through AJAX, sends back
the jobs' statuses to client's browser.
The thing is: jobs get scheduled, they finish at proper time, but
don't execute the code block at all - even if I put some simple { puts
"job executed" } there.
When "start" action waits for all the jobs to finish (through
sleep(20)), the block gets executed, though.
It seemed to me that block contents get purged as soon as controller's
action finishes, and thus tried to use Proc instance variable for
creating a block and then passing it. However it thows an error:
NoMethodError (undefined method `delete' for #<Proc:0x2aaaac6e0970>):
/usr/lib/ruby/gems/1.8/gems/openwferu-scheduler-0.9.11/lib/openwfe/
util/scheduler.rb:480:in `to_block'
/usr/lib/ruby/gems/1.8/gems/openwferu-scheduler-0.9.11/lib/openwfe/
util/scheduler.rb:425:in `sschedule_at'
/usr/lib/ruby/1.8/monitor.rb:238:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/openwferu-scheduler-0.9.11/lib/openwfe/
util/scheduler.rb:402:in `sschedule_at'
/usr/lib/ruby/gems/1.8/gems/openwferu-scheduler-0.9.11/lib/openwfe/
util/scheduler.rb:191:in `schedule_at'
/usr/lib/ruby/gems/1.8/gems/openwferu-scheduler-0.9.11/lib/openwfe/
util/scheduler.rb:204:in `schedule_in'
.//app/controllers/auction_controller.rb:18:in `start'
And this one ain't solved even with sleep(20)
So, do You know of a working way to schedule new tasks in controller's
action which would actually execute block that gets passed to them in
schedule_in/at ?
Regards,
Tomasz Stachewicz
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"OpenWFEru users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/openwferu-users?hl=en
-~----------~----~----~----~------~----~------~--~---