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

Discard earliest heartbeat once there are 30 heartbeats #8724

Merged
merged 6 commits into from
Jan 27, 2025
Merged
Changes from 1 commit
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
Prev Previous commit
Formatting
  • Loading branch information
dlarocque committed Jan 23, 2025
commit 1df988765ba1e6c49d3183a75dbf08a9c20a83e6
8 changes: 6 additions & 2 deletions packages/app/src/heartbeatService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,14 +283,18 @@ describe('HeartbeatServiceImpl', () => {
clock.tick(24 * 60 * 60 * 1000);
}

expect(heartbeatService._heartbeatsCache?.heartbeats.length).to.equal(MAX_NUM_STORED_HEARTBEATS);
expect(heartbeatService._heartbeatsCache?.heartbeats.length).to.equal(
MAX_NUM_STORED_HEARTBEATS
);
const earliestHeartbeatDate = getEarliestHeartbeatIdx(
heartbeatService._heartbeatsCache?.heartbeats!
);
const earliestHeartbeat =
heartbeatService._heartbeatsCache?.heartbeats[earliestHeartbeatDate]!;
await heartbeatService.triggerHeartbeat();
expect(heartbeatService._heartbeatsCache?.heartbeats.length).to.equal(MAX_NUM_STORED_HEARTBEATS);
expect(heartbeatService._heartbeatsCache?.heartbeats.length).to.equal(
MAX_NUM_STORED_HEARTBEATS
);
expect(
heartbeatService._heartbeatsCache?.heartbeats.indexOf(earliestHeartbeat)
).to.equal(-1);
Expand Down
Loading