Skip to content

Commit

Permalink
fix(shardQuerySplitting): start with loading state Loading and switch…
Browse files Browse the repository at this point in the history
… to Streaming
  • Loading branch information
matyax committed Sep 11, 2024
1 parent ef38488 commit bbe917c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/services/shardQuerySplitting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function splitQueriesByStreamShard(
splittingTargets: LokiQuery[]
) {
let shouldStop = false;
let mergedResponse: DataQueryResponse = { data: [], state: LoadingState.Streaming, key: uuidv4() };
let mergedResponse: DataQueryResponse = { data: [], state: LoadingState.Loading, key: uuidv4() };
let subquerySubscription: Subscription | null = null;
let retriesMap = new Map<number, number>();
let retryTimer: ReturnType<typeof setTimeout> | null = null;
Expand Down Expand Up @@ -128,6 +128,9 @@ function splitQueriesByStreamShard(
return;
}
}
if (mergedResponse.data.length) {
mergedResponse.state = LoadingState.Streaming;
}
mergedResponse = combineResponses(mergedResponse, partialResponse);
},
complete: () => {
Expand Down

0 comments on commit bbe917c

Please sign in to comment.