Cron

From FiranMUX

Jump to: navigation, search

Cron Borked

Cron occasionally gets completely borked and it's mostly due to the fact that MUX2 hardcode runs so much faster than the softcode. So the softcode gets tripped up every so often as hardcode gets executed before certain softcode commands that may have actually called the hardcode commands.


The process for fixing this (if you aren't Jeanne or Theo) is very simple:

 Check '@ps/all' 
 If the cron is running something, other than 'Run the next check in X seconds' wait for it to be done.
 If the cron isn't running something else:
   1. Run '@cron/stop' 
   2. Wait <x> seconds (however long it is). 
   3. Run '@cron/start'
 If that doesn't fix the issue, it is a really broken and needs to be fixed by Jeanne or Theo.  Just escalate the issue to them.

Cron Catchup

The cron catchup is put in place so that time can be skipped without any mixed-up, mis-run jobs. The old cron would continue to run 'current' jobs even while the old jobs were being caught up. This could potentially cause some weird things (the stars coming out after the sun had risen, for example). There was also a need for DIFFERENT jobs to be run INSTEAD of the normal Cron (or CronIC) jobs. An example of this is apartment rent (We didn't want anyone penalized or kicked out of their apartment simply because time was being skipped).


The way this was instituted was to use two tags (used only for the cron), 'Catchup' and 'Catchup-IC'.


When the time difference (between when the Cron/CronIC last ran and the current time/ICtime) is greater than the set limit, the cron (or CronIC) automatically goes into catchup/skip mode.


When the time difference is less than a second set limit, the cron (or CronIC) drops back out of catchup/skip mode.


The first set time limit is set on the cron object on the 'Secs-Apart-Skip' attribute and is defaulted to '86400' (24 hours). The number is the number of SECONDS difference between the last run and current time.


The second set time limit is also set on the cron object. This time, on the 'Secs-Apart-NoSkip' attribute and is defaulted to '600' (10 minutes). The number is the number of SECONDS difference between the last run and current time.


To get a job to be 'skipped' (not run) while in catchup/skip mode, simply add the job name (for example AptRent, NOT CronIC_Job_AptRent) to the 'Skip-Jobs' attribute on the cron object.


If you want a DIFFERENT job run (for example, have apartment rent incremented by one IC day INSTEAD of just skipped), you have to have it added to 'Skip-Jobs' as WELL as have a 'Skip' job (for example, SkipIC_Job_AptRent) for the cron to run in its place. This job will be run whenever the cron is in Catchup-IC mode.

Personal tools