This repository was archived by the owner on Aug 1, 2025. It is now read-only.
Pass timeoutMs value in the request headers#4921
Merged
Merged
Conversation
olafurpg
approved these changes
Jul 19, 2024
taras-yemets
referenced
this pull request
in sourcegraph/sourcegraph-public-snapshot
Jul 19, 2024
Closes [CODY-2775](https://linear.app/sourcegraph/issue/CODY-2775/%5Bautocomplete-latency%5D-apply-the-same-timeout-on-the-cody-gateway-side) Enables client control over the request processing timeout on the server (both Sourcegraph backend and Cody Gateway). The context timeout is set to the value provided in the `X-Timeout-Ms` header of the client request. If the header is not provided, the default context timeout is used (1 minute on both Sourcegraph backend and Cody Gateway). Previously, we only had a default timeout on the Sourcegraph backend side (8 minutes). Corresponding client change: - https://github.com/sourcegraph/cody/pull/4921 <!-- 💡 To write a useful PR description, make sure that your description covers: - WHAT this PR is changing: - How was it PREVIOUSLY. - How it will be from NOW on. - WHY this PR is needed. - CONTEXT, i.e. to which initiative, project or RFC it belongs. The structure of the description doesn't matter as much as covering these points, so use your best judgement based on your context. Learn how to write good pull request description: https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e?pvs=4 --> ## Test plan - Manually tested and confirmed that if the request contains the `X-Timeout-Ms` header, its value is used. If not, the default maximum request duration is applied. - CI - <!-- All pull requests REQUIRE a test plan: https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles --> ## Changelog - Use the provided timeout from request parameters if available; otherwise use the default maximum request duration (8 minutes) <!-- 1. Ensure your pull request title is formatted as: $type($domain): $what 2. Add bullet list items for each additional detail you want to cover (see example below) 3. You can edit this after the pull request was merged, as long as release shipping it hasn't been promoted to the public. 4. For more information, please see this how-to https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c? Audience: TS/CSE > Customers > Teammates (in that order). Cheat sheet: $type = chore|fix|feat $domain: source|search|ci|release|plg|cody|local|... --> <!-- Example: Title: fix(search): parse quotes with the appropriate context Changelog section: ## Changelog - When a quote is used with regexp pattern type, then ... - Refactored underlying code. -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of CODY-2775
Sends the
timeoutMsconfig value to the backend using viaX-Timeout-Msheader in both default and fast paths.Backend support added in https://github.com/sourcegraph/sourcegraph/pull/63875
Test plan
Manually tested (using a debugger) alongside https://github.com/sourcegraph/sourcegraph/pull/63875 on both default and fast paths, using a locally running Sourcegraph instance and Cody Gateway.