diff --git a/packages/backend/src/misc/skipped-instances.ts b/packages/backend/src/misc/skipped-instances.ts index de42e14d2..97e654b25 100644 --- a/packages/backend/src/misc/skipped-instances.ts +++ b/packages/backend/src/misc/skipped-instances.ts @@ -40,7 +40,10 @@ export async function shouldBlockInstance(host: string): Promise { * @returns array of punycoded instance hosts that should be skipped (subset of hosts parameter) */ export async function skippedInstances(hosts: Array): Promise> { - 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;