title: Sidekiq: Ensure all jobs on the queue are unique
body: <p>I have some update triggers which push jobs onto the Sidekiq queue. So in some cases, there can be multiple jobs to process the same object.</p>
  
  <p>There are a couple of uniqueness plugins (<a href="https://github.com/krasnoukhov/sidekiq-middleware">"Middleware"</a>, <a href="https://github.com/mhenrixon/sidekiq-unique-jobs">Unique Jobs</a>), they're not documented much, but they seem to be more like throttlers to prevent <em>repeat processing</em>; what I want is a throttler that prevents <em>repeat creating</em> of the same jobs. That way, an object will always be processed in its freshest state. Is there a plugin or technique for this?</p>
  
  <hr>
  
  <p><em>Update: I didn't have time to make a middleware, but I ended up with a related cleanup function to ensure queues are unique: <a href="https://gist.github.com/mahemoff/bf419c568c525f0af903">https://gist.github.com/mahemoff/bf419c568c525f0af903</a></em></p>