Permalink
Browse files

Add events back to queue on error

  • Loading branch information...
1 parent 44f1ac8 commit 541ecb1d8a0ff84c2048eaa6521d27f6f5231f99 @trotter trotter committed May 11, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/cube/emitter-http.js
View
@@ -26,12 +26,13 @@ module.exports = function(protocol, host, port) {
};
var postRequest = http.request(postOptions, function(res) {
+ if (res.statusCode !== 200) queue.unshift.apply(queue, events);
if (queue.length) setTimeout(send, 500);
});
postRequest.on('error', function (e) {
console.warn(e.message);
- // TODO: Add events back to queue on error
+ queue.unshift.apply(queue, events);
});
postRequest.write(body);

0 comments on commit 541ecb1

Please sign in to comment.