title: If I schedule a worker to run every day on Heroku, how can I be sure it doesn't run twice or get skipped?
body: <p>I'm a bit confused as to how Clockwork, Sidekiq, and Redis all fit together on Heroku given that Heroku restarts dynos at least once a day.</p>
  
  <p>Say I have a worker that runs once a day, so it's configured in <code>config/clock.rb</code> as:</p>
  
  <pre><code>module Clockwork
    every(1.day, 'Resend confirmation') { ResendConfirmationWorker.perform_async }
  end
  </code></pre>
  
  <p>In this worker, I get all the users who have created an account but haven't confirmed it within two days, and resend a confirmation email to each of them.</p>
  
  <pre><code>class ResendConfirmationWorker
    include Sidekiq::Worker
    sidekiq_options queue: :resend_confirmation, retry: false
  
    def perform
      d = Time.zone.now - 2.days
      users = User.where.not(confirmation_sent_at: nil)
                  .where(confirmed_at: nil)
                  .where(created_at: d.beginning_of_day..d.end_of_day)
  
      users.find_each do |user|
        user.send_confirmation_instructions
      end
    end
  end
  </code></pre>
  
  <p>Let's say someone signs up on Monday, this job runs on Wednesday, finds them, and sends them a second confirmation email. Then the dyno gets restarted for whatever reason, and the job runs again. They'll get yet another email. Or alternatively, if the restart happens the moment before the job needs to run, then they won't get anything.</p>
  
  <p>How does Clockwork have any concept of jobs longer than 24 hours, given that its “lifespan” in a Heroku dyno? Is there a way to simply manage this limitation without having to constantly save this sort of thing to the database?</p>