Skip to content

Fix timeout calculation to account for event duration and playback speed#1768

Open
Copilot wants to merge 22 commits intomasterfrom
copilot/sub-pr-1762
Open

Fix timeout calculation to account for event duration and playback speed#1768
Copilot wants to merge 22 commits intomasterfrom
copilot/sub-pr-1762

Conversation

Copy link
Contributor

Copilot AI commented Jan 2, 2026

The test timeout was hardcoded to 2 minutes regardless of event duration or playback speed, causing failures for longer recordings or slower playback.

Changes:

  • Calculate timeout dynamically: (max_timestamp - min_timestamp) / playback_speed + 120000ms
  • Extract min/max timestamps from events array
  • Read playback speed from config.rrwebPlayer.speed (defaults to 1x)
  • Add debug logging for timeout calculation

Example:

// Before: Fixed 2 minute timeout
const timeout = setTimeout(() => reject(new Error('Replay timeout')), 120000);

// After: Dynamic timeout based on actual event duration
const eventDuration = maxTimestamp - minTimestamp;
const playbackSpeed = config.rrwebPlayer.speed ?? 1;
const timeoutDuration = Math.ceil(eventDuration / playbackSpeed) + 120000;
const timeout = setTimeout(() => reject(new Error('Replay timeout')), timeoutDuration);

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

ruiconti and others added 20 commits January 24, 2025 14:41
Without this change, build would fail because the produced stylesheet assumes
the `package.json['name']` i.e., `styles/rrweb.css`. To maintain the existing
behavior, these changes are required.

See https://vite.dev/guide/migration.html#customize-css-output-file-name-in-library-mode
Update playwright dependency to latest version and refactor test execution options to use a shared configuration with increased timeout for stability.
Update playwright dependency to latest version and refactor test execution options to use a shared configuration with increased timeout for stability.
…cess

Add detailed console.log statements throughout the transformToVideo function to track execution flow and debug potential issues. Logging covers browser launch, context creation, page navigation, replay progress, and video file operations.
…bility

- Add Playwright Chromium installation step to CI workflow
- Change test execution stdio from 'pipe' to 'inherit' for better debugging
…t listeners

Set autoPlay to false in replayer configuration and manually call play() after all event listeners are attached. This ensures event handlers are properly registered before playback begins, preventing potential race conditions.

Also refactor test execution options to separate stdio configuration from timeout settings for better control over test output visibility.
Add comprehensive error handling to prevent hanging during video transformation:
- Add 2-minute timeout for replay finish event
- Add console and error listeners for better debugging
- Improve promise chain with proper error catching
- Clear timeout on successful completion or error

This prevents the process from hanging indefinitely when the replay finish event never fires.
Wrap replayer initialization in try-catch block to handle potential errors gracefully. Restructure Player instantiation to use rrwebPlayer directly instead of rrwebPlayer.Player, and move width/height into props object for correct API usage. On error, log to console and trigger onReplayFinish callback to prevent hanging state.
@changeset-bot
Copy link

changeset-bot bot commented Jan 2, 2026

⚠️ No Changeset found

Latest commit: b494d77

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

- Extract min/max timestamps from events
- Use playback speed from config (default to 1)
- Calculate timeout: (max - min) / speed + 2 minute buffer
- Add debug logging for timeout calculation

Co-authored-by: Juice10 <4106+Juice10@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 2, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • edgedl.me.gvt1.com
    • Triggering command: /usr/local/bin/node /usr/local/bin/node install.js (dns block)
  • https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/1036745/chrome-linux.zip
    • Triggering command: /usr/local/bin/node node install.js (http block)
    • Triggering command: /usr/local/bin/node /usr/local/bin/node install.js (http block)
  • https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/869685/chrome-linux.zip
    • Triggering command: /usr/local/bin/node /usr/local/bin/node install.js (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Update timeout calculation based on review comments Fix timeout calculation to account for event duration and playback speed Jan 2, 2026
Copilot AI requested a review from Juice10 January 2, 2026 10:36
@Juice10 Juice10 marked this pull request as ready for review January 2, 2026 20:15
Base automatically changed from juice10/pr-1637-tests to master February 6, 2026 14:11
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