Skip to content

Commit

Permalink
fix: retries for WoRm should be much smaller (3)
Browse files Browse the repository at this point in the history
  • Loading branch information
ztalbot2000 committed Feb 21, 2023
1 parent 8c69f30 commit 1135163
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
20 changes: 16 additions & 4 deletions Cmd4PriorityPollingQueue.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,11 @@ class Cmd4PriorityPollingQueue
{
queue.log.warn( `*${ count }* error(s) were encountered for "${ entry.accessory.displayName }" getValue. Last error found Getting: "${ entry.characteristicString}". Perhaps you should run in debug mode to find out what the problem might be.` );

// Call updateValue with new Error so device will become unavailable
entry.accessory.service.getCharacteristic( CMD4_ACC_TYPE_ENUM.properties[ entry.accTypeEnumIndex ].characteristic ).updateValue( null, new Error( constants.errorString( error ) ) );
// queue.log.warn( "processHighPrioritySetQueue calling updateCharacteristic");
// Call updateCharacteristic with new Error so device will become unavailable
//entry.accessory.service.updateCharacteristic( CMD4_ACC_TYPE_ENUM.properties[ entry.accTypeEnumIndex ].characteristic, new Error( constants.errorString( error ) ) );
let storedValue = entry.accessory.cmd4Storage.getStoredValueForIndex( entry.accTypeEnumIndex );
entry.accessory.service.getCharacteristic( CMD4_ACC_TYPE_ENUM.properties[ entry.accTypeEnumIndex ].characteristic ).updateValue( storedValue, new Error( constants.errorString( error ) ) );

} else
{
Expand Down Expand Up @@ -250,8 +253,11 @@ class Cmd4PriorityPollingQueue
{
queue.log.warn( `*${ count }* error(s) were encountered for "${ entry.accessory.displayName }" getValue. Last error found Getting: "${ entry.characteristicString}". Perhaps you should run in debug mode to find out what the problem might be.` );

// Call updateValue with new Error so device will become unavailable
entry.accessory.service.getCharacteristic( CMD4_ACC_TYPE_ENUM.properties[ entry.accTypeEnumIndex ].characteristic ).updateValue( null, new Error( constants.errorString( error ) ) );
// queue.log.warn( "processHighPriorityGetQueue calling updateCharacteristic");
// Call updateCharacteristic with new Error so device will become unavailable
//entry.accessory.service.updateCharacteristic( CMD4_ACC_TYPE_ENUM.properties[ entry.accTypeEnumIndex ].characteristic, new Error( constants.errorString( error ) ) );
let storedValue = entry.accessory.cmd4Storage.getStoredValueForIndex( entry.accTypeEnumIndex );
entry.accessory.service.getCharacteristic( CMD4_ACC_TYPE_ENUM.properties[ entry.accTypeEnumIndex ].characteristic ).updateValue( storedValue, new Error( constants.errorString( error ) ) );

} else
{
Expand Down Expand Up @@ -294,6 +300,12 @@ class Cmd4PriorityPollingQueue
queue.errorCountSinceLastGoodTransaction = 0;

} else {
// queue.log.warn( "processEntryFromLowPriorityQueue calling updateCharacteristic");
// Call updateCharacteristic with new Error so device will become unavailable
//entry.accessory.service.updateCharacteristic( CMD4_ACC_TYPE_ENUM.properties[ entry.accTypeEnumIndex ].characteristic, new Error( constants.errorString( error ) ) );
let storedValue = entry.accessory.cmd4Storage.getStoredValueForIndex( entry.accTypeEnumIndex );
entry.accessory.service.getCharacteristic( CMD4_ACC_TYPE_ENUM.properties[ entry.accTypeEnumIndex ].characteristic ).updateValue( storedValue, new Error( constants.errorString( error ) ) );

queue.pauseQueue( entry.accessory.queue );
}

Expand Down
2 changes: 1 addition & 1 deletion cmd4Constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ var cmd4Constants = {
// Used internally to mean entries go straight through the queue
QUEUETYPE_PASSTHRU: "None",
DEFAULT_STANDARD_QUEUE_RETRY_COUNT: 1,
DEFAULT_WORM_QUEUE_RETRY_COUNT: 50,
DEFAULT_WORM_QUEUE_RETRY_COUNT: 3,
QUEUE_RETRIES: "retries",


Expand Down

0 comments on commit 1135163

Please sign in to comment.