saeedvaziry / laravel-async

Laravel Async
MIT License
129 stars 9 forks source link

Process cleanup handler #2

Open gregsuper opened 11 months ago

gregsuper commented 11 months ago

I would like to thank you for the package provided as an alternative to workers, which allows, in my development concept, to instantly run the required code asynchronously.

I have an idea for improving the package - it would be nice to have a handler for cleaning up all running processes by the package. This way we can clean up all running processes without waiting for their timeout when necessary. For example, like: php artisan queue:clear

Sample code I'm currently using to clean up all processes on linux: Process::quietly()->run('for pid in $(pgrep -f laravel-async); do kill $pid; done');

What do you think about this idea or are there certain conditions and limitations where integrating cleanup without waiting for a timeout seems like a bad idea?

saeedvaziry commented 10 months ago

Hey @greglaych, Sounds like a good idea to me. an addition to that would be a command to get the list of the currently running processes with their process ID. Feel free to open a PR 💪