Parallel cron - PostponedTaskCron

PostponedTaskCron can run scheduled tasks since version 5.7.40. It is a so-called "Parallel cron", i.e. a cron that can be cloned and run multiple times. This allows you to handle a larger number of long-running tasks.

Before running PostponedTaskCron , you need to deactivate cron Cron! Then do not enable it again , PostponedTaskCron replaces the original Cron!

Parallel operation deployment procedure

To use PostponedTaskCron to run scheduled tasks in parallel, the following procedure is required:

  1. Disable cron Cron
  2. Set the PostponedTaskCron schedule as needed
  3. Copy PostponedTaskCron and set its schedule, e.g. 30s later than the first cron (the goal is to ensure that the copied crons do not run at the same time)
  4. Make as many clones as needed

Configuration

The following parameters can be set within cron:

fromTime

Defines when cron will start taking scheduled tasks. A string or timestamp can be entered. The default is set to null (which means 1970). This setting is useful if for some reason you need to set another cron to start from a specific date. It is basically a safety net for when a cron gets busy and doesn't want to run another one.

lockTtl

The time for which the task is locked, during which time it is not possible to activate the task. In order for cron to process and activate the scheduled task, a unique record must be written to Redis. If it does not receive it, the task will skip. This ensures that two or more crons do not try to activate the same task at the same time. Locks are not explicitly unlocked, but their flatness is allowed to expire. The default value is 30 minutes (1800000 ms). Such a task can therefore only be activated after the given deadline.

Frantisek Brych Updated by Frantisek Brych

Crons

Contact

Syca (opens in a new tab)

Powered by HelpDocs (opens in a new tab)