Skip to content

Serialize Wattsi requests and add timeout - #217

Merged
tobie merged 1 commit into
mainfrom
claude/magical-lamport-smmncg
Sep 24, 2026
Merged

tobie merged 1 commit into
mainfrom
claude/magical-lamport-smmncg

Conversation

@tobie

@tobie tobie commented Sep 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

This change ensures that Wattsi requests are processed sequentially across all PRs being handled by the process, and adds a timeout to prevent requests from stalling indefinitely.

Key Changes

  • Added a global wattsiQueue that serializes all fetchZip calls across different PR instances using a oneAtATime wrapper function
  • Each request waits for the previous one to settle (succeed or fail) before proceeding, preventing concurrent builds on the Wattsi server
  • Added a WATTSI_TIMEOUT constant (10 minutes) to the POST request to prevent indefinite hangs
  • Updated the fetch() method to wrap both fetchZip calls with oneAtATime()

Implementation Details

  • The oneAtATime function chains promises sequentially: wattsiQueue.then(fn, fn) ensures the function runs regardless of whether the previous promise resolved or rejected
  • Failed requests don't block subsequent ones: wattsiQueue = run.catch(() => {}) swallows errors so they don't propagate to the next queued request
  • Tests verify that only one Wattsi request is in-flight at a time across multiple PR instances, and that failed requests don't block subsequent ones

https://claude.ai/code/session_014Wpzz6o6jpVTWPb22dXBBT

The Wattsi server doesn't appear to cope with concurrent builds, but
several whatwg/html PRs can be processed at once, each posting to it.
Queue every fetchZip call in the process behind the previous one, so the
server only ever sees one request, and give requests a 10-minute timeout
so a stalled one can't hold up the queue forever.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014Wpzz6o6jpVTWPb22dXBBT
@tobie
tobie merged commit 7211172 into main Sep 24, 2026
1 check passed
@tobie
tobie deleted the claude/magical-lamport-smmncg branch September 24, 2026 20:15
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.

2 participants