Skip to content

Commit

Permalink
fix: The actual updateValue call now that other stuff is in place
Browse files Browse the repository at this point in the history
  • Loading branch information
ztalbot2000 committed Feb 20, 2023
1 parent b8ddf9c commit 8c69f30
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions Cmd4PriorityPollingQueue.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,23 @@ class Cmd4PriorityPollingQueue
// The "Set" is complete, even if it failed.
queue.inProgressSets --;

// Set failed. We need to keep trying
queue.highPriorityQueue.push( entry );

queue.errorCountSinceLastGoodTransaction++;
let count = queue.errorCountSinceLastGoodTransaction;

if ( count != 0 && count % queue.queueRetryCount == 0 )
{
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 ) ) );

} else
{
// Set failed. We need to keep trying
queue.highPriorityQueue.push( entry );

}

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

Expand Down Expand Up @@ -243,7 +251,8 @@ 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 ) ) );
entry.accessory.service.getCharacteristic( CMD4_ACC_TYPE_ENUM.properties[ entry.accTypeEnumIndex ].characteristic ).updateValue( null, new Error( constants.errorString( error ) ) );

} else
{
// High Priority Get failed. We keep retrying until the mod of
Expand Down

0 comments on commit 8c69f30

Please sign in to comment.