Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: wait for node to wake up before starting lifeline healthcheck #4376

Merged
merged 1 commit into from
Mar 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions packages/zwave-js/src/lib/node/Node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3955,6 +3955,15 @@ protocol version: ${this.protocolVersion}`;
})...`,
);

if (this.canSleep && this.status !== NodeStatus.Awake) {
// Wait for node to wake up to avoid incorrectly long delays in the first health check round
this.driver.controllerLog.logNode(
this.id,
`waiting for node to wake up...`,
);
await this.waitForWakeup();
}

const results: LifelineHealthCheckResult[] = [];
for (let round = 1; round <= rounds; round++) {
// Determine the number of repeating neighbors
Expand All @@ -3975,6 +3984,7 @@ protocol version: ${this.protocolVersion}`;
txReport = report;
},
});

for (let i = 1; i <= healthCheckTestFrameCount; i++) {
const start = Date.now();
const pingResult = await pingAPI.send().then(
Expand Down