server: fix instance skipping
All checks were successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
All checks were successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
This should actually make instance skipping work properly since shouldBlockInstance is now properly awaited on now.
This commit is contained in:
parent
9ad37a12f8
commit
5e6b51094e
1 changed files with 4 additions and 1 deletions
|
@ -40,7 +40,10 @@ export async function shouldBlockInstance(host: string): Promise<boolean> {
|
|||
* @returns array of punycoded instance hosts that should be skipped (subset of hosts parameter)
|
||||
*/
|
||||
export async function skippedInstances(hosts: Array<Instance['host']>): Promise<Array<Instance['host']>> {
|
||||
const skipped = hosts.filter(host => shouldBlockInstance(host));
|
||||
// Resolve the boolean promises before filtering
|
||||
const shouldSkip = await Promise.all(hosts.map(shouldBlockInstance));
|
||||
const skipped = hosts.filter((_, i) => shouldSkip[i]);
|
||||
|
||||
// if possible return early and skip accessing the database
|
||||
if (skipped.length === hosts.length) return hosts;
|
||||
|
||||
|
|
Loading…
Reference in a new issue