Is there a way to limit the number of instances of a rake task?
I have a rake task for reading emails that runs every 5 mins as a cron job.
Sometimes the rake tasks takes more than 5 mins to complete and another rake task is launched before it finishes.
There are hacky workarounds to check ps -Af
inside the rake file but I
am looking for cleaner way to limit launching multiple instances of the
rake tasks similar to how the daemon gem does.
Checking emails is just an example, I have several such rake tasks that involve polling multiple servers.