Skip to content

fix: release deferred batch requests after each run - #385

Open
gtalusan wants to merge 1 commit into
plasticrake:mainfrom
gtalusan:main
Open

fix: release deferred batch requests after each run#385
gtalusan wants to merge 1 commit into
plasticrake:mainfrom
gtalusan:main

Conversation

@gtalusan

Copy link
Copy Markdown
Contributor

Summary

  • fix a leak in deferAndCombine() by clearing the queued request resolver list after each deferred batch starts running
  • keep batching behavior the same while making requestCount reflect only the current batch
  • add a regression test proving separate batches no longer reuse the previous request queue

Why

The deferred helper kept every prior batch's resolve/reject callbacks in the shared requests array for the lifetime of the device instance. That meant the queue grew over time and later batches saw cumulative requestCount values. Clearing the request queue once a batch has been captured releases those references and prevents the leak.

Testing

  • focused Jest run for test/utils.spec.ts using a temporary config override in this workspace because the repo test ignore pattern includes /build/ and this checkout lives under /Users/george/build/...

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.

1 participant