steelThread/mimeograph — pull request #41 by carlost (2012-06-14 17:35:06+00:00)
Title: Track errors between jobs

The original intent was to perform the work outlined in issue #39 "errors that occur "between" jobs result in lost jobs". However, I realized that all of the errors i saw in production were slipping through because the check Job.spawn used to determine if the child process had an error was incorrect. The check was "if code", and would trip error handling logic if code was > 0. Unfortunately, nodejs states that the code will be null if the process doesn't terminate normally. In these cases, Job.spawn thought the job was successful and the job class passed the location of a file thought to have been generated by the child process back to resque. When mimeo then tried to store the non-existent file into redis ... pow! in order to prevent these i corrected the error check in Job.spawn and introduced explicit path.exists calls to verify the generated file exists.

i also update Mimeograph.createJob to clean up any existing hset that corresponds to the key that the job will use. this could result in the client never being notified of the jobs completion. this key "clash" could occur when a job is rerun after mimeo stalls out or the client is disconnected.