Skip to content

Commit 8128b12

Browse files
committed
doc str
1 parent b9ecf20 commit 8128b12

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

packages/amazonq/src/app/inline/recommendationService.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,13 @@ export class RecommendationService {
153153
)
154154
ps.push(editPromise)
155155

156+
/**
157+
* First come first serve, ideally we should simply return the first response returned. However there are some caviar here because either
158+
* (1) promise might be returned early without going through service
159+
* (2) some users are not enabled with edits suggestion, therefore service will return empty result without passing through the model
160+
* With the scenarios listed above or others, it's possible that 1 promise will ALWAYS win the race and users will NOT get any suggestion back.
161+
* This is the hack to return first "NON-EMPTY" response
162+
*/
156163
let result = await Promise.race(ps)
157164
if (ps.length > 1 && result.items.length === 0) {
158165
for (const p of ps) {

0 commit comments

Comments
 (0)