I\'m using the Bluebird promise library. I have a chain of promisified functions like the following:
receiveMessageAsync(params) .then(function(data)
I just released https://github.com/zyklus/promise-repeat, which retries a promise until it either times out or a maximum number of attempts are hit. It allows you to write:
receiveMessageAsync(params) ... .spread(retry( function(response, data) { return sendResponseAsync(response); } )) ...