Skip to content

Stop dual-channel flush timers after streaming closes - #231

Open
codebanditssss wants to merge 1 commit into
AssemblyAI:mainfrom
codebanditssss:audit/dual-channel-send-after-close
Open

codebanditssss wants to merge 1 commit into
AssemblyAI:mainfrom
codebanditssss:audit/dual-channel-send-after-close

Conversation

@codebanditssss

Copy link
Copy Markdown

Summary

Reject dual-channel sendAudio() when the socket is not open, matching single-channel behavior. Clear the flush interval again after the termination wait, since audio arriving during that wait can restart it. Include regression tests and the required version/changelog update.

The dual-channel path currently buffers unsendable audio and starts an interval before connect or after close. That interval keeps Node alive. Sending while close() waits can also restart the interval after its initial cleanup.

Reproduction

Create a transcriber with mic/system channels and call sendAudio(pcm, { channel: "mic" }) before connect(), or after close(false). Baseline accepts the bytes and starts an interval instead of throwing. Also send tagged audio between close() sending Terminate and receiving Termination.

Seven tests cover before connect, client/server close, both and partial-channel sends during termination, timeout, and normal mixing.

Validation

  • Real local TLS WebSocket child processes: 5 of 6 baseline scenarios required an 8-second kill; all 6 fixed processes exited normally with no timers.
  • Focused related suites: 47 passed.
  • Full unit suite with NODE_OPTIONS=--no-experimental-global-navigator: 590 passed.
  • Build, eslint, TypeScript, formatting and publint pass, with existing warnings.
  • Default Node 22 runs retain the same three upstream user-agent failures.
  • No paid API or integration tests were run.

Before-connect callers now get Socket is not open for communication; that audio was not delivered previously. Audio sent during the termination wait remains accepted.

This is separate from the established-session reconnection/listener problem in issue #228.

This branch has not been deployed

No deployments
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