Skip to content

Add user-configurable timeout to wasm http requests#133

Draft
ianthomas23 wants to merge 1 commit intomainfrom
http_timeout
Draft

Add user-configurable timeout to wasm http requests#133
ianthomas23 wants to merge 1 commit intomainfrom
http_timeout

Conversation

@ianthomas23
Copy link
Member

WIP to add a timeout to wasm http requests. Such requests are synchronous blocking requests so we cannot obtain any feedback to present to the user whilst they are underway, and we have to wait until the corresponding http reply is received in full. These requests can take a long time fi they are clones of a large repo, as lots of data needs to be transferred back to us and usually this is a two-step return as it has to be via a CORS proxy. In the event of the request failing, if there isn't a timeout then the operation will block forever and cockle will be unresponsive forever. Note that this is the stage that occurs before the returned data is processed for which we do have progress reported to the user.

Ideally we'd use an asynchronous non-blocking request for this and it is part of our long term plan to implement asynchronous emscripten-forge terminal and kernel packages, but this is not yet available and is non-trivial to implement now.

Here there is a default timeout of 10 seconds (this is TBD really) and it can be overridden by the user via an environment variable:

export GIT_HTTP_TIMEOUT=20

This is a WIP as there is more to do:

  • test downstream
  • decide on sensible default
  • add better documentation in the help
  • in the event of a request timing out print useful information to the user to tell them that they can make the timeout longer
  • add tests

@ianthomas23 ianthomas23 added the enhancement New feature or request label Mar 27, 2026
@codecov
Copy link

codecov bot commented Mar 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.27%. Comparing base (5f536c5) to head (8cf45b1).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #133   +/-   ##
=======================================
  Coverage   88.27%   88.27%           
=======================================
  Files          61       61           
  Lines        2627     2627           
  Branches      309      309           
=======================================
  Hits         2319     2319           
  Misses        308      308           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant