lantins/resque-retry — pull request #48 by d11wtq (2012-04-13 03:54:03+00:00)
Title: Use SHA1 for default #retry_identifier

Myself and @pda have been having some pretty horrible problems in production with a particular job that uses large job args. The issue stems from the fact that resque-retry encodes the entire argument list in full, which produces extremely long keys in redis. This is actually unnecessary as a default, so this patch simply does the same thing, but passes the identifier through SHA1 before returning it. Users can still override this default. This should be completely backward compatible, because the key is not used for job retrieval.

Keys that used to look like (often many megabytes long):

resque-retry:SomeJob:something-really-longwith-spacesstrippedandsomecrazy\r\ncharacters

Now look like this:

resque-retry:SomeJob:6664635c88a68259340d77f7c6e974dede4ec026

In this specific example, resque is being used to defer the insertion of detailed HTTP traffic logging into the MySQL database, so the entire HTTP request headers and body need to be contained in the job arguments.