Skip to content

test: fix firefox stress test#3435

Draft
dozyio wants to merge 2 commits intolibp2p:mainfrom
dozyio:fix/firefox-stress-test
Draft

test: fix firefox stress test#3435
dozyio wants to merge 2 commits intolibp2p:mainfrom
dozyio:fix/firefox-stress-test

Conversation

@dozyio
Copy link
Copy Markdown
Collaborator

@dozyio dozyio commented Apr 4, 2026

Description

Replaced generic drain-event waiting with the stream-native backpressure API in packages/interface-compliance-tests/src/stream-muxer/stress-test.ts:

  • Changed await pEvent(outboundStream, 'drain', { rejectionEvents: ['close'] }) to await outboundStream.onDrain().
  • This preserves behaviour (wait until writable; reject if stream closes/resets) while avoiding high per-iteration listener/promise overhead in the stress loop.
  • Wrapped this.processSendQueue in queueMicrotask to avoid blowing up the stack.

Observed impact:

  • Firefox: ~27–30s down to 3-4s.
  • Chromium: 2-2.5s down to 1.5-2s

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation if necessary (this includes comments as well)
  • I have added tests that prove my fix is effective or that my feature works

@dozyio dozyio marked this pull request as ready for review April 4, 2026 21:14
@dozyio dozyio requested a review from a team as a code owner April 4, 2026 21:14
@dozyio dozyio marked this pull request as draft April 4, 2026 22:02
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