Skip to content

fix: make health events emission consistent#2570

Merged
weboko merged 2 commits into
masterfrom
weboko/health-events
Aug 20, 2025
Merged

fix: make health events emission consistent#2570
weboko merged 2 commits into
masterfrom
weboko/health-events

Conversation

@weboko

@weboko weboko commented Aug 19, 2025

Copy link
Copy Markdown
Collaborator

Problem / Description

Health indicator has difficult logic to comprehend leading to bugs being easily introduced.

Solution

Make clear re-calculation of health state on every event.

Notes

@weboko
weboko requested a review from a team as a code owner August 19, 2025 21:19
@weboko
weboko requested a review from Copilot August 19, 2025 21:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the HealthIndicator to make health state re-calculation more consistent and comprehensible by extracting the health assessment logic into a single method that is called on every relevant event.

  • Extracts health assessment logic into a centralized assessHealth() method
  • Adds initial health assessment when the indicator starts
  • Simplifies event handlers to consistently call the assessment method

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/sdk/src/health_indicator/health_indicator.ts Refactors health logic into assessHealth() method and adds initial assessment on start
packages/sdk/src/health_indicator/health_indicator.spec.ts Updates tests to handle new behavior and adds comprehensive test coverage for edge cases

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@weboko weboko changed the title fix: make health events emission consistent fix: make health events emission consisten Aug 20, 2025
@weboko weboko changed the title fix: make health events emission consisten fix: make health events emission consistent Aug 20, 2025
@weboko
weboko force-pushed the weboko/health-events branch from 2744660 to 8c865b3 Compare August 20, 2025 10:09
@github-actions

github-actions Bot commented Aug 20, 2025

Copy link
Copy Markdown

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
Waku node 70.43 KB (+0.03% 🔺) 1.5 s (+0.03% 🔺) 1.1 s (-11.87% 🔽) 2.5 s
Waku Simple Light Node 121.86 KB (-0.01% 🔽) 2.5 s (-0.01% 🔽) 1.2 s (-8.29% 🔽) 3.7 s
ECIES encryption 20.8 KB (0%) 417 ms (0%) 377 ms (-27.92% 🔽) 794 ms
Symmetric encryption 20.3 KB (0%) 407 ms (0%) 457 ms (+13.37% 🔺) 863 ms
DNS discovery 51.57 KB (0%) 1.1 s (0%) 967 ms (+10.79% 🔺) 2 s
Peer Exchange discovery 52.29 KB (0%) 1.1 s (0%) 817 ms (+25.57% 🔺) 1.9 s
Peer Cache Discovery 46.11 KB (0%) 923 ms (0%) 1.3 s (+90.31% 🔺) 2.2 s
Privacy preserving protocols 53.54 KB (0%) 1.1 s (0%) 859 ms (+6.24% 🔺) 2 s
Waku Filter 55.32 KB (0%) 1.2 s (0%) 1.2 s (-12.71% 🔽) 2.3 s
Waku LightPush 52.91 KB (0%) 1.1 s (0%) 816 ms (+2.41% 🔺) 1.9 s
History retrieval protocols 59.28 KB (0%) 1.2 s (0%) 1.2 s (+48.01% 🔺) 2.4 s
Deterministic Message Hashing 28.41 KB (0%) 569 ms (0%) 649 ms (+74.62% 🔺) 1.3 s

@weboko
weboko merged commit c8dfdb1 into master Aug 20, 2025
10 of 11 checks passed
@weboko
weboko deleted the weboko/health-events branch August 20, 2025 11:13
@weboko weboko mentioned this pull request Aug 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: fix health events emission

3 participants