Skip to content

Commit

Permalink
Merge master into feature/cwltail
Browse files Browse the repository at this point in the history
  • Loading branch information
aws-toolkit-automation authored Nov 12, 2024
2 parents 5b80409 + 886ab29 commit 7b4477e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion packages/core/src/codewhisperer/util/editorContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,11 @@ export async function buildGenerateRecommendationRequest(editor: vscode.TextEdit
const fileContext = extractContextForCodeWhisperer(editor)

const tokenSource = new vscode.CancellationTokenSource()
// the supplement context fetch mechanisms each has a timeout of supplementalContextTimeoutInMs
// adding 10 ms for overall timeout as buffer
setTimeout(() => {
tokenSource.cancel()
}, supplementalContextTimeoutInMs)
}, supplementalContextTimeoutInMs + 10)
const supplementalContexts = await fetchSupplementalContext(editor, tokenSource.token)

logSupplementalContext(supplementalContexts)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ export async function fetchSupplementalContextForSrc(
async function () {
return await fetchSupplementalContextForSrcV1(editor, cancellationToken)
},
{ timeout: supplementalContextTimeoutInMs, interval: 10, truthy: false }
{ timeout: supplementalContextTimeoutInMs, interval: 5, truthy: false }
)
const promiseV2 = waitUntil(
async function () {
return await fetchSupplementalContextForSrcV2(editor)
},
{ timeout: supplementalContextTimeoutInMs, interval: 10, truthy: false }
{ timeout: supplementalContextTimeoutInMs, interval: 5, truthy: false }
)
const [resultV1, resultV2] = await Promise.all([promiseV1, promiseV2])
return resultV2 ?? resultV1
Expand Down

0 comments on commit 7b4477e

Please sign in to comment.