Skip to content

Commit

Permalink
Bump page size and add warning logs (#628)
Browse files Browse the repository at this point in the history
  • Loading branch information
adhityamamallan authored Aug 16, 2024
1 parent 98a16b8 commit 4e8431d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/views/domains-page/helpers/get-all-domains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,29 @@ import { unstable_cache } from 'next/cache';

import CLUSTERS_CONFIGS from '@/config/clusters/clusters.config';
import * as grpcClient from '@/utils/grpc/grpc-client';
import logger from '@/utils/logger';

import filterDomainsIrrelevantToCluster from './filter-domains-irrelevant-to-cluster';
import getUniqueDomains from './get-unique-domains';

const MAX_DOMAINS_TO_FETCH = 2000;

export const getAllDomains = async () => {
const results = await Promise.all(
CLUSTERS_CONFIGS.map(({ clusterName }) =>
grpcClient
.getClusterMethods(clusterName)
.listDomains({ pageSize: 1000 })
.listDomains({ pageSize: MAX_DOMAINS_TO_FETCH })
.then(({ domains }) => {
if (domains.length >= MAX_DOMAINS_TO_FETCH - 100) {
logger.warn(
{
domainsCount: domains.length,
maxDomainsCount: MAX_DOMAINS_TO_FETCH,
},
'Number of domains in cluster approaching/exceeds max number of domains that can be fetched'
);
}
return filterDomainsIrrelevantToCluster(clusterName, domains);
})
)
Expand Down

0 comments on commit 4e8431d

Please sign in to comment.