Add configurable extension download timeout setting#274761
Conversation
Do not make this general http setting, instead scope this only to extension requests. So name it accordingly. You can place this setting in |
- Add `http.requestTimeout` configuration with 60000ms default - Update extension gallery service to use configurable timeout - Remove hardcoded REQUEST_TIME_OUT constant - Allow users to customize timeout for slow corporate proxies Co-authored-by: sandy081 <[email protected]>
- Add DEFAULT_REQUEST_TIMEOUT constant (60000ms) - Use constant in getRequestTimeout() method instead of magic number - Improves maintainability and consistency Co-authored-by: sandy081 <[email protected]>
- Move setting from http.requestTimeout to extensions.requestTimeout - Register setting in extensions.contribution.ts as requested - Update extensionGalleryService to use extensions.requestTimeout - Revert changes to request.ts (no longer general HTTP setting) Co-authored-by: sandy081 <[email protected]>
Done. Changed from |
There was a problem hiding this comment.
Pull Request Overview
This PR adds a configurable timeout for HTTP requests made to the Extensions Marketplace. Previously, requests used a hardcoded timeout of 10 seconds; now users can configure this timeout via the extensions.requestTimeout setting, with a new default of 60 seconds.
- Introduces
extensions.requestTimeoutconfiguration setting with a default of 60,000ms - Replaces hardcoded
REQUEST_TIME_OUTconstant (10,000ms) with dynamicgetRequestTimeout()method - Validates configured timeout values ensuring they are numbers and non-negative
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/vs/platform/extensionManagement/common/extensionManagement.ts | Exports new configuration key constant ExtensionRequestsTimeoutConfigKey |
| src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts | Registers the timeout configuration setting in the workbench with validation and metadata |
| src/vs/platform/extensionManagement/common/extensionGalleryService.ts | Implements getRequestTimeout() method and replaces all hardcoded timeout values with dynamic configuration |
| }, | ||
| [ExtensionRequestsTimeoutConfigKey]: { | ||
| type: 'number', | ||
| description: localize('extensionsRequestTimeout', "Controls the timeout in milliseconds for HTTP requests made when fetching extensions from the Marketplace"), |
There was a problem hiding this comment.
Configuration descriptions should end with a period for consistency with other settings in this file (see lines 260, 265, 270, 277, 283, 302).
| description: localize('extensionsRequestTimeout', "Controls the timeout in milliseconds for HTTP requests made when fetching extensions from the Marketplace"), | |
| description: localize('extensionsRequestTimeout', "Controls the timeout in milliseconds for HTTP requests made when fetching extensions from the Marketplace."), |
There was a problem hiding this comment.
I guess y'all ignored this bot comment :)
|
|
||
| private getRequestTimeout(): number { | ||
| const configuredTimeout = this.configurationService.getValue<number>(ExtensionRequestsTimeoutConfigKey); | ||
| return isNumber(configuredTimeout) && configuredTimeout >= 0 ? configuredTimeout : 60_000; |
There was a problem hiding this comment.
The fallback value 60_000 is a magic number duplicated from line 308 in extensions.contribution.ts. Consider extracting this as a named constant (e.g., DEFAULT_REQUEST_TIMEOUT) to avoid duplication and make maintenance easier if the default ever needs to change.
Corporate proxies with security scanning can stall initial data transfer for 60+ seconds, causing extension installation failures with the hardcoded 10-second timeout.
Changes
Configuration (
src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts)extensions.requestTimeoutsetting (default: 60000ms, min: 0)Extension Gallery Service (
src/vs/platform/extensionManagement/common/extensionGalleryService.ts)REQUEST_TIME_OUT = 10_000withDEFAULT_REQUEST_TIMEOUT = 60000constantgetRequestTimeout()to read fromextensions.requestTimeoutconfiguration with fallback to defaultUsage
{ "extensions.requestTimeout": 90000 // 90 seconds }Set to 0 to disable timeout.
Addresses @chrmarti's feedback to increase default before adding configurability and @sandy081's feedback to scope the setting to extensions only rather than making it a general HTTP setting.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.