#Is there a way to know if "schedule:work" is currently running or not?

1 messages · Page 1 of 1 (latest)

fading wren
#

I have a requirement in my app's admin panel to show if the schedule:work is running properly. I've created my own "status page" that checks if each command is executed successfully.

Now, I need to know if the schedule:work command is running or not, and my team has currently proposed using websockets to find out in real time.

It feels like "the juice isn't worth the squeeze" to use websockets to find this out, so exploring if there is an alternative to this

#

(I'm on a shared hosting unfortunately. So I can't use supervisord and make the script auto-restart)

glad coral
#

Avoid shared hosting is the answer, schedule:work likely isn't stable for prod

#

you'd probably struggle to find out if the process is even running due to sandboxing

fading wren
#

Okay.

Instead of schedule:work, what do you recommend for prod?

#

schedule:run?

glad coral
#

Yeah in a cron

fading wren
#

Okay. I run schedule:run every minute.

#

Or, generally what's the best practice?

glad coral
#

your schedule command should take less than a minute

fading wren
#

Okay. If I understand correctly, the schedule command taking less than a minute to execute is key here

glad coral
#

Yeah, anything long-running should be dispatched to queues

fading wren
#

Got it.

glad coral
#

if it's a command then you can use ->runInBackground()

fading wren
#

I've added.

...
->withoutOverlapping()
->runInBackground();