Skip to content

Call _onComplete on all leading replay discard paths#1369

Merged
matux merged 1 commit into
feature/matux/streaming-capturefrom
matux/fix-cleanup
Oct 13, 2025
Merged

Call _onComplete on all leading replay discard paths#1369
matux merged 1 commit into
feature/matux/streaming-capturefrom
matux/fix-cleanup

Conversation

@matux

@matux matux commented Oct 12, 2025

Copy link
Copy Markdown
Contributor

Description of the change

This PR fixes ScheduledCapture._onComplete not being called on some cleanup paths causing trailing statuses for a given replayId to leak.

This PR also extracts the tracing post call into a private post function in ScheduledCapture.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Maintenance
  • New release

@matux matux requested review from Copilot and waltjones October 12, 2025 22:30
@matux matux self-assigned this Oct 12, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 fixes a bug where ScheduledCapture._onComplete wasn't being called on all cleanup paths, causing memory leaks of trailing statuses for replay IDs. The change moves the _onComplete call to the discard method to ensure it's called consistently, and extracts the posting logic into a reusable _post method.

  • Moved _onComplete callback from sendLeading to discard method for consistent cleanup
  • Extracted HTTP posting logic into a private _post method for better code organization

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

@matux matux force-pushed the matux/fix-cleanup branch from 3763b46 to 2ad267e Compare October 12, 2025 22:31
@matux matux merged commit d57843a into feature/matux/streaming-capture Oct 13, 2025
6 checks passed
@matux matux deleted the matux/fix-cleanup branch October 13, 2025 17:15
matux added a commit that referenced this pull request Oct 13, 2025
* Add _pendingContextIfReady and rename cursor in context (#1364)
* Remove index.js from tests (#1366)
* Init logger on replay integration tests to log errors (#1367)
* Rethrow span export errors to prevent unnecessary sendIfReady calls (#1368)
* Call _onComplete on all leading replay discard paths (#1369)
* `ScheduledStreamCapture` to survive multiple rrweb checkouts (#1371)
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.

3 participants