Revert "fix: harden automatic mobile boards"
This reverts commit d0b9348b86.
This commit is contained in:
1 parent
967ed8dd73
commit
e93293f8a9
22 files changed
+69
-491
No files matched your search
@@ -20,21 +20,11 @@ interface Options<TIntegration extends IntegrationLike, TResult> {
|
||||
throwOnAllFailures?: boolean;
|
||||
}
|
||||
|
||||
export interface IntegrationQueryProvenance {
|
||||
failedIntegrationCount: number;
|
||||
staleIntegrationCount: number;
|
||||
}
|
||||
|
||||
interface IntegrationQuerySettlement<TResult> {
|
||||
results: TResult[];
|
||||
failedIntegrationCount: number;
|
||||
}
|
||||
|
||||
const settleIntegrationQueriesInternal = async <TIntegration extends IntegrationLike, TResult>(
|
||||
export async function settleIntegrationQueries<TIntegration extends IntegrationLike, TResult>(
|
||||
integrations: TIntegration[],
|
||||
fn: (integration: TIntegration) => Promise<TResult>,
|
||||
options?: Options<TIntegration, TResult>,
|
||||
): Promise<IntegrationQuerySettlement<TResult>> => {
|
||||
): Promise<TResult[]> {
|
||||
const settled = await Promise.allSettled(integrations.map(async (integration) => fn(integration)));
|
||||
const results: TResult[] = [];
|
||||
const errors: unknown[] = [];
|
||||
@@ -73,32 +63,5 @@ const settleIntegrationQueriesInternal = async <TIntegration extends Integration
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
results,
|
||||
failedIntegrationCount: settled.filter((result) => result.status === "rejected").length,
|
||||
};
|
||||
};
|
||||
|
||||
export async function settleIntegrationQueries<TIntegration extends IntegrationLike, TResult>(
|
||||
integrations: TIntegration[],
|
||||
fn: (integration: TIntegration) => Promise<TResult>,
|
||||
options?: Options<TIntegration, TResult>,
|
||||
): Promise<TResult[]> {
|
||||
return (await settleIntegrationQueriesInternal(integrations, fn, options)).results;
|
||||
}
|
||||
|
||||
export async function settleIntegrationQueriesWithProvenance<
|
||||
TIntegration extends IntegrationLike,
|
||||
TResult extends { isStale?: boolean },
|
||||
>(
|
||||
integrations: TIntegration[],
|
||||
fn: (integration: TIntegration) => Promise<TResult>,
|
||||
options?: Options<TIntegration, TResult>,
|
||||
): Promise<IntegrationQuerySettlement<TResult> & IntegrationQueryProvenance> {
|
||||
const settlement = await settleIntegrationQueriesInternal(integrations, fn, options);
|
||||
|
||||
return {
|
||||
...settlement,
|
||||
staleIntegrationCount: settlement.results.filter((result) => result.isStale === true).length,
|
||||
};
|
||||
return results;
|
||||
}
|
||||
Reference in new issue
Block a user