I have a simple sidekiq job that I've set to run every 5 minutes using clockwork. What I'm worried about is that, if the job takes longer than 5 minutes, it will run again, which could cause some issues if it's running at the same time as the original job.
Is there a way to lock the clockwork so that it only runs if the previous running has completed?
One option is to create a file with the process PID when the job starts, and delete it when the job ends, and abort the job at the beginning if the PID file already exists.
Although this particular part of my app isn't using sidekiq, the idea is the same. Here's how my app does it: https://github.com/WikiEducationFoundation/WikiEduDashboard/blob/master/lib/data_cycle/constant_update.rb