Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump page size and add warning logs for ListDomains #628

Merged
merged 1 commit into from
Aug 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading