File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
packages/amazonq/src/app/inline Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff 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 ) {
You can’t perform that action at this time.
0 commit comments