Rolling deploys create a race condition where newly enqueued Sidekiq jobs reference a class that old worker processes haven't loaded yet, causing NameError crashes. The standard fix—two-phase deploys or feature flags—works but adds manual overhead to every deploy. The author built sidekiq-requeue_missing_class, a Sidekiq server middleware gem that intercepts jobs with unresolvable class names and requeues them with a configurable delay instead of raising. It handles both native Sidekiq and ActiveJob payloads, uses Object.const_get (the same path Sidekiq uses) so Rails autoloading works correctly, and gives up after a configurable max_requeues count so genuinely broken class names still surface as real errors. The gem doesn't help with incompatible argument changes—that still requires two-phase deploys.

7m read timeFrom dmitrytsepelev.dev
Post cover image
Table of contents
Why a class you just deployed is “missing”The workarounds, and why they get oldThe fixHow it works under the hoodWhen you don’t need it
143 Impressions