forked from FoundKeyGang/FoundKey
server: fix instance skipping
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