refactor: Async functions don't need to explicitly return promises (no-changelog) (#6041)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-04-24 11:17:08 +00:00
committed by GitHub
parent 03be725cef
commit 308a94311f
31 changed files with 148 additions and 209 deletions

View File

@@ -527,15 +527,12 @@ export default mixins(externalHooks, genericHelpers, executionHelpers, showMessa
// Suppose 504 finishes before 500, 501, 502 and 503.
// iF you use firstId, filtering id >= 504 you won't
// ever get ids 500, 501, 502 and 503 when they finish
const pastExecutionsPromise: Promise<IExecutionsListResponse> =
this.workflowsStore.getPastExecutions(filter, this.requestItemsPerRequest);
const currentExecutionsPromise: Promise<IExecutionsCurrentSummaryExtended[]> = isEmpty(
filter.metadata,
)
? this.workflowsStore.getCurrentExecutions({})
: Promise.resolve([]);
const promises = [this.workflowsStore.getPastExecutions(filter, this.requestItemsPerRequest)];
if (isEmpty(filter.metadata)) {
promises.push(this.workflowsStore.getCurrentExecutions({}));
}
const results = await Promise.all([pastExecutionsPromise, currentExecutionsPromise]);
const results = await Promise.all(promises);
for (const activeExecution of results[1]) {
if (