Is there a way to suspend scheduled service jobs during a data load?

We routinely grab snapshot data from a client machine and restore it as such:

$ gradle cleanDb
$ java -server -Djava.awt.headless=true -XX:-OmitStackTraceInFastThrow -XX:+UseG1GC -Xmx16384m -jar moqui.war load raw location=~/Downloads/

Is there something we can do to keep it running scheduled jobs during the data load? I believe what I’m seeing is as soon as the scheduled jobs entity gets established it thinks…gee, I haven’t run them for a while…I better do all that and a bunch of them fire off, slowing down the import.

There are three ways that come to mind:

  1. data driven (would require changing data in the .zip file): set ServiceJobRunLock.lastRunTime to something more recent or in the future
  2. data driven part 2: on the ServiceJob records changed paused to Y in the .zip file
  3. config driven: set the scheduled_job_check_time env var or property to 0, this disabled the scheduled job runner

Excellent, thank you, David.

You probably resolved this already, but one of the things we do is have a service that “Suspends” the running jobs and a service that resumes the jobs. We run the suspend before a deployment and resume after.

Since the JobRunner only looks at paused=N, we set the value to S, then switch them back on resume.

I could create a PR to community if that’s something interesting.

1 Like