in laravel, i'm running job in code this
artisan::queue('mediaserver:process-queue', ['index' => $indexname]);
same job scheduled run in background each hour. want trigger via ui (so via code) fasten things up. need prevent is, process starts while running in background.
what best working method this?
laravel's task scheduler handles overlapping jobs creating temp file before command runs, , destroying after.
the name of file based on cron schedule expression , command name.
the existence of file cause subsequent attempts run same command skipped
i similar this. @ top of mediaserver:process-queue
task i'd check if temp file named mediaserver__process_queue
existed in storage/
. if does, quit. if doesn't create it. destroy when task ends.
you have careful how handle scenarios task quits unexpectedly uncaught exception, causing mediaserver__process_queue
remain though task no longer running.
Comments
Post a Comment