Remove duplicate Resque jobs that have already been queued for processing.
To run this against a Rails installtion in production
use the following command: bundle exec rails runner -e production /path/to/script/remove_duplicates.rb
. See rails runner
for more information.
Ideally no workers should be running while this script is running. This is NOT meant to be a real-time solution. That is, this script is not meant to be run continuously to fix an issue where a queue constantly injects duplicates into the queue. If that is the problem you are encountering please see the resque-loner gem. This is meant to be a 1 time solution for a situation where a large queue was manually created and would be difficult to recreate again without the duplicates.
This is not a great method for removing duplicates from a queue; and could possibly take a significant amount of time on a queue with >1M records. But it will eventually de-dup the queue. See: Removing Duplicates from a List.