Skip to content

Commit

Permalink
fix: unnecessary logging during rebuildNodeRoutes when node has no …
Browse files Browse the repository at this point in the history
…other associations than the controller (#6940)
  • Loading branch information
AlCalzone authored Jun 17, 2024
1 parent 6cdedab commit 467150f
Showing 1 changed file with 29 additions and 24 deletions.
53 changes: 29 additions & 24 deletions packages/zwave-js/src/lib/controller/Controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4744,34 +4744,39 @@ supported CCs: ${
/* ignore */
}

this.driver.controllerLog.logNode(nodeId, {
message: `assigning return routes to the following nodes:
if (associatedNodes.length > 0) {
this.driver.controllerLog.logNode(nodeId, {
message: `assigning return routes to the following nodes:
${associatedNodes.join(", ")}`,
direction: "outbound",
});
for (const destinationNodeId of associatedNodes) {
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
this.driver.controllerLog.logNode(nodeId, {
message:
`assigning return route to node ${destinationNodeId} (attempt ${attempt})...`,
direction: "outbound",
});

if (
await this.assignReturnRoutes(nodeId, destinationNodeId)
) {
// this step was successful, continue with the next
break;
}

if (attempt === maxAttempts) {
direction: "outbound",
});
for (const destinationNodeId of associatedNodes) {
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
this.driver.controllerLog.logNode(nodeId, {
message:
`rebuilding routes failed: failed to assign return route after ${maxAttempts} attempts`,
level: "warn",
direction: "none",
`assigning return route to node ${destinationNodeId} (attempt ${attempt})...`,
direction: "outbound",
});
return false;

if (
await this.assignReturnRoutes(
nodeId,
destinationNodeId,
)
) {
// this step was successful, continue with the next
break;
}

if (attempt === maxAttempts) {
this.driver.controllerLog.logNode(nodeId, {
message:
`rebuilding routes failed: failed to assign return route after ${maxAttempts} attempts`,
level: "warn",
direction: "none",
});
return false;
}
}
}
}
Expand Down

0 comments on commit 467150f

Please sign in to comment.