Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit 541ecb1

Browse files
committed
Add events back to queue on error
1 parent 44f1ac8 commit 541ecb1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/cube/emitter-http.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,13 @@ module.exports = function(protocol, host, port) {
2626
};
2727

2828
var postRequest = http.request(postOptions, function(res) {
29+
if (res.statusCode !== 200) queue.unshift.apply(queue, events);
2930
if (queue.length) setTimeout(send, 500);
3031
});
3132

3233
postRequest.on('error', function (e) {
3334
console.warn(e.message);
34-
// TODO: Add events back to queue on error
35+
queue.unshift.apply(queue, events);
3536
});
3637

3738
postRequest.write(body);

0 commit comments

Comments
 (0)