OK, so this is the code at the bottom of environment.rb now:

$scheduler = Scheduler.new

class << $scheduler
  def lwarn (msg)
    RAILS_DEFAULT_LOGGER.warn msg
  end

  def step
    super
    RAILS_DEFAULT_LOGGER.debug "step: scheduler.at_job_count is
#{$scheduler.at_job_count} (#{$scheduler.object_id})"
  end

end

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

Auction.schedule_pending


I've scheduled a job from the application level (to start an auction)
to execute at 13:40:30, then shut down the server, and then restarted
it (everything on standard development default Mongrel). This is a
piece from my log:

(snip: thousands lines like the one below)
2007-08-28 13:40:29 DEBUG logger (:) - step: scheduler.at_job_count is
23 (23456261299860)
2007-08-28 13:40:29 DEBUG logger (:) - step: scheduler.at_job_count is
23 (23456261299860)
2007-08-28 13:40:29 DEBUG logger (:) - step: scheduler.at_job_count is
23 (23456261299860)
2007-08-28 13:40:29 DEBUG logger (:) - step: scheduler.at_job_count is
23 (23456261299860)
2007-08-28 13:40:30 DEBUG logger (:) - step: scheduler.at_job_count is
22 (23456261299860)
2007-08-28 13:40:30 DEBUG logger (:) - step: scheduler.at_job_count is
22 (23456261299860)
2007-08-28 13:40:30 DEBUG logger (:) - step: scheduler.at_job_count is
22 (23456261299860)
2007-08-28 13:40:30 DEBUG logger (:) - step: scheduler.at_job_count is
22 (23456261299860)
(snip: thousands like the one above)

So, the job has been removed from queue (23->22) at proper time, but
is has not been executed (if it had been, there'd be an extra line in
the logs like.

!!!
Funny thing though - seems that calling Auction.schedule_pending in
environment.rb somehow "spoils" the scheduler and - WOW - makes other,
normally scheduled (at later time) jobs also unexecuted!
Calling it from within the application after it starts is completely
OK, though - schedules pending jobs, they get executed, any jobs
scheduled after the call are also successfully executed.
/!!!

Trying to redefine lwarn and step (what I actually did was defining a
class Scheduler2 < Scheduler and making $scheduler an instance of
Scheduler2) methods didn't give any results - step does what it should
(executes every 0.25s), lwarn doesn't give any errors.

I just don't know what to think about this.


--~--~---------~--~----~------------~-------~--~----~
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