Hello again!

I'm writing an auction site in RoR, where auctions have to be
scheduled for starting and for finishing. I'm using OpenWFEru and it
works like charm (John's great responses in the other thread I've
started previously contributed to that :)) with executing scheduled
"start auction" and "end auction" job.

My Scheduler instance is a global variable, to be usable amongst every
part of Rails application:

$scheduler = Scheduler.new
$scheduler.start
RAILS_DEFAULT_LOGGER.warn "started scheduler #{ Time.now }"

This works, this is good, this is fast.

However, when server process is restarted (this happens a lot during
development, as we all know, and can occur in production), all the
scheduled jobs are naturally lost. Thus I've added a static method to
Auction model which re-schedules everything.

When this "reschedule" method is invoked from some controller (i.e.
"manually" started by site admin), it works perfectly: jobs get
scheduled and are executed when they should be.

However, when I put the call to reschedule method in environment.rb,
the jobs get scheduled (the log-lines "job A scheduled for B at C" are
written, the job id's get assigned), but they don't survive afterwards
and are not executed.
BUT when "past" jobs get scheduled (i.e. to be executed immediately
after scheduling), they ARE executed.

I've replayed this behavior with even the simplest cases of jobs
scheduled from environment.rb - they seem to be scheduled, but are
forgotten and remain unexecuted. With the exception of jobs scheduled
to "a second ago".
The same jobs scheduled in controller work, of course, perfectly,
executing at given time.

This has something to do with Rails application lifecycle, but could
anyone point out how to prevent this "forgetfulness" and have jobs at
application start both scheduled and executed?

Tomek "Tomash" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to