CLI and scheduler · Question 9 of 12

An import command is started by cron every minute, but a run can take longer. Two runs must never work at the same time. How do you prevent this with TYPO3 means?

1 answer is correct. Medium

Show answer

Answer

  • D Create a locker with LOCK_CAPABILITY_EXCLUSIVE | LOCK_CAPABILITY_NOBLOCK via the LockFactory, try acquire() and exit immediately on failure

Explanation

The LockFactory chooses a suitable locking strategy (file, semaphore, …). With NOBLOCK acquire() returns immediately instead of waiting, so the second run can exit cleanly. At the end release() frees the lock. A self-made flag in the registry remains after a crash and is not atomic. For scheduler tasks there is additionally the setting for parallel execution.

Certifications & exams

Which exam comes next?

You can already practise for 19 exams, and 21 are up for a vote. See all certifications with their official information, cast your vote or suggest your exam.

See all certifications