1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-16 12:55:13 +03:00

timeout and retry improvements

This commit is contained in:
Pawel Spychalski (DzikuVx) 2017-01-21 22:50:29 +01:00
parent daf06fa466
commit 4ae45333a8
3 changed files with 22 additions and 7 deletions

View file

@ -56,12 +56,18 @@ helper.mspQueue = (function (serial, MSP) {
*/
publicScope.executor = function () {
/*
* Debug
*/
helper.eventFrequencyAnalyzer.put("execute");
privateScope.loadFilter.apply(privateScope.queue.length);
/*
* if port is blocked or there is no connection, do not process the queue
*/
if (privateScope.portInUse || serial.connectionId === false) {
helper.eventFrequencyAnalyzer.put("port in use");
return false;
}
@ -82,9 +88,17 @@ helper.mspQueue = (function (serial, MSP) {
MSP.removeCallback(request.code);
/*
* Create new entry in the queue
* To prevent infinite retry situation, allow retry only while counter is positive
*/
publicScope.put(request);
if (request.retryCounter > 0) {
request.retryCounter--;
/*
* Create new entry in the queue
*/
publicScope.put(request);
}
}, serial.getTimeout());
if (request.sentOn === null) {