Skip to content

Commit 6b97cc7

Browse files
author
Aitor Magán García
committed
Fix #190. Max Retry Time
1 parent 79cbb39 commit 6b97cc7

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

lib/configBase.js

+6
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ exports.longFailingTimeout = 10000;
106106
*/
107107
exports.minQuorum = 2;
108108

109+
/*
110+
Max retry time (milliseconds)
111+
the sum of the different retry intervals must be less than this value
112+
*/
113+
exports.maxRetryTime = 20 * 60 * 1000; //20 mins
114+
109115

110116
/* LISTENER AND CONSUMER CONFIGURATION
111117
======================================

lib/eventWorker.js

+14
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,20 @@ function validateHeaders(simpleRequest) {
165165

166166
errorsHeaders.push(error);
167167
}
168+
169+
var sum = 0;
170+
for (var i = 0; i < retrySplit.length; i++) {
171+
sum += Number(retrySplit[i]);
172+
}
173+
174+
if (sum > configGlobal.maxRetryTime) {
175+
var error = {}
176+
error.type = MG.INVALID_PARAMETER;
177+
error.parameter = MG.HEAD_RELAYER_RETRY;
178+
error.userMessage = 'The sum of the different intervals must be less than ' + configGlobal.maxRetryTime +' ms';
179+
180+
errorsHeaders.push(error);
181+
}
168182
}
169183

170184
//check Persistence Header

0 commit comments

Comments
 (0)