apply suggestion
All checks were successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/test Pipeline was successful

This commit is contained in:
Norm 2022-12-01 03:35:59 -05:00
parent 492c116510
commit d3cf94b602
Signed by: norm
GPG key ID: 7123E30E441E80DE

View file

@ -35,10 +35,7 @@ export async function shouldBlockInstance(host: Instance['host']): Promise<boole
* @returns array of punycoded instance hosts that should be skipped (subset of hosts parameter) * @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']>> { export async function skippedInstances(hosts: Array<Instance['host']>): Promise<Array<Instance['host']>> {
// first check for blocked instances since that info may already be in memory const skipped = hosts.filter(host => shouldBlockInstance(host));
const { blockedHosts } = await fetchMeta();
const skipped = hosts.filter(host => blockedHosts.some(blockedHost => sameOrSubdomainOf(host, blockedHost)));
// if possible return early and skip accessing the database // if possible return early and skip accessing the database
if (skipped.length === hosts.length) return hosts; if (skipped.length === hosts.length) return hosts;