Skip to content

Instantly share code, notes, and snippets.

@pwmckenna
Created July 9, 2013 20:08
Show Gist options
  • Save pwmckenna/5960807 to your computer and use it in GitHub Desktop.
Save pwmckenna/5960807 to your computer and use it in GitHub Desktop.
var taskComplete = q.defer();
queue.pop(taskComplete.promise).then(function (message) {
var tasks = transcode(message).then(torrentize).then(makePreviews);
// This will basically pipe the output of everything we're doing into the taskComplete promise...
// so if tasks is rejected, the message will be put back into the queue and we'll receive it
// again in this callback
taskComplete.resolve(tasks);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment