Skip to content

Instantly share code, notes, and snippets.

@guyguyon
Created March 21, 2018 16:24
Show Gist options
  • Select an option

  • Save guyguyon/f30dd9d9dffb7c2a2ac519e4b093d35b to your computer and use it in GitHub Desktop.

Select an option

Save guyguyon/f30dd9d9dffb7c2a2ac519e4b093d35b to your computer and use it in GitHub Desktop.

Persisted Sidekiq

Sidekiq is a Redis-backed Ruby library for creating background jobs.

Obviously, Redis is in memory. Since our tasks are very important, we cannot tolerate "missing" jobs as a consequence of Redis failures (such as sudden shutdown due to electricity issues and so on).

Your task is to create PersistedSidekiq, Redis-backed with DB fallback library for creating background jobs.

Requirements

  1. PersistedSidekiq should use Sidekiq internally.
  2. PersistedSidekiq should have the same API as Sidekiq.
  3. PersistedSidekiq should be able to recover, automatically, from Redis shutdowns (It means that Redis may be shut down and loose all its data at any time, and PersistedSidekiq will recover).
  4. Recovery does not need to happen as soon as Redis come back, it may happen a while after.
  5. PersistedSidekiq is expected to be used in a cluster of workers.
  6. Upload your code to Github and send us a link.

Notes

  • Pay careful attention to all the different cases
  • The end product should be simple Ruby project (no need for public Gem refinements)
  • Every functionality should be tested with the required level. We're not interested in some sort of minimum coverage, we prefer to have the required logic covered.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment