Hi Claire,
The last time I looked at the scheduler code, tasks could only be triggered by 
the clock, not by events. Some entities like production orders, sales orders, 
and invoices can trigger code from events using the workflow, but products and 
bills of materials don't have workflow.

This isn't really a good place for asking questions like that. You'd be
better to ask them at http://www.openerp.com/forum/ or
http://stackoverflow.com/

-- 
You received this bug notification because you are a member of OpenERP
CTP, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/677257

Title:
  Scheduler won't reschedule a task if it takes too long

Status in OpenERP Server:
  Fix Released
Status in OpenERP Server 5.0 series:
  Fix Released

Bug description:
  We ran into this problem because we were running the mrp scheduler
  every two minutes and it started to take longer than a minute to run.
  Suddenly, it would just stop being scheduled.

  It looks like this is what happens in the ir_cron._poolJobs() method:

  1. Get the current time and hold it in the "now" variable.
  2. Find all active jobs whose next call time has passed.
  3. Run each job.
  4. Increment the next call time by the job's interval until it passes the 
"now" variable which may be a few minutes in the past if the jobs took a while 
to execute.
  5. Update the job's next call time in the database.
  6. Find all active jobs whose next call time is in the future and schedule 
the first one.

  If a job ends up getting scheduled for a time after the "now" variable
  but before step 6 executes then it will no longer be executed.

  Here's a scenario where that could happen. The mrp scheduler is
  scheduled to run every five minutes and it takes two minutes to run.

  10:00 mrp starts
  10:02 mrp finishes, scheduled for 10:05
  10:03 admin shuts down the server for maintenance
  10:09 admin starts up the server and connects to database. mrp starts
  10:11 mrp finishes, scheduled for 10:10 (10:05 plus 5 minutes, it's after 
10:09). mrp is no longer in the list of tasks in memory.

  Once this happens, I think there is a two-in-five chance that the mrp
  task will run once at start up and not be scheduled after that.

  Why does step six above need to check that the next time is in the
  future? Shouldn't it just schedule the minimum time for all active
  tasks?

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/677257/+subscriptions

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to