Check canceled_at before every row is processed and stop processing if it's set.
This will ensure that jobs that are actively processing will stop. It's a little slower, because you have to reload the record before each record is processed.
Stretch goal is to make the "cancel" action actually use the sidekiq_jid to send a message killing the job directly. However, we need to test this really well to make sure it stops jobs reliably.
canceled_at
timestamp.canceled_at
before every row is processed and stop processing if it's set.This will ensure that jobs that are actively processing will stop. It's a little slower, because you have to reload the record before each record is processed.
Stretch goal is to make the "cancel" action actually use the
sidekiq_jid
to send a message killing the job directly. However, we need to test this really well to make sure it stops jobs reliably.