GitBulletin

Repository: farcasterxyz/hub-monorepo

Code Red Alert: Shuttle’s CPU Crisis Averted with Crucial Await Fix!

2024-08-01 16:28:07 UTC

Missing `await` in sleep function sparks a whirlwind of CPU usage, but developers have swooped in to rescue performance and efficiency!

Commit Details:

fix(shuttle): Add missing `await` to per-iteration `sleep()` call (#2232) ## Why is this change needed? The fix for high CPU usage due to busy-waiting (release v0.5.9) wasn't effective because `sleep()` returns a Promise which wasn't being `await`ed, so the containing `while` loop was still iterating unchecked thousands of times per second. This should fix for good. ## Merge Checklist _Choose all relevant options below by adding an `x` now or at any time before submitting for review_ - [x] PR title adheres to the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) standard - [x] PR has a [changeset](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#35-adding-changesets) - [x] PR has been tagged with a change label(s) (i.e. documentation, feature, bugfix, or chore) - [ ] PR includes [documentation](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#32-writing-docs) if necessary. <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on fixing a bug in the `shuttle` package where an `await` was missing in the `sleep()` call, potentially causing CPU thrashing. ### Detailed summary - Added missing `await` to `sleep()` call in `eventStream.ts` to prevent CPU thrashing. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->

Search Similar