mirror of
https://github.com/cerc-io/watcher-ts
synced 2026-09-09 01:04:07 +00:00
Add config for query limit in compare CLI (#175)
* Add config for query limit in compare CLI * Fix JSON stringify bigint for GQL query params * Take last N entity ids to compare in GQL
This commit is contained in:
@@ -120,6 +120,14 @@ export const main = async (): Promise<void> => {
|
||||
let resultDiff = '';
|
||||
|
||||
if (fetchIds) {
|
||||
const queryLimit = config.queries.queryLimits[queryName];
|
||||
|
||||
if (queryLimit) {
|
||||
// Take only last `queryLimit` entity ids to compare in GQL.
|
||||
const idsLength = updatedEntityIds[index].length;
|
||||
updatedEntityIds[index].splice(0, idsLength - queryLimit);
|
||||
}
|
||||
|
||||
for (const id of updatedEntityIds[index]) {
|
||||
const { diff, result1: result } = await compareQuery(
|
||||
clients,
|
||||
|
||||
@@ -36,6 +36,7 @@ interface QueryConfig {
|
||||
queryDir: string;
|
||||
names: string[];
|
||||
blockDelayInMs: number;
|
||||
queryLimits: { [queryName: string]: number }
|
||||
}
|
||||
|
||||
interface EntityDerivedFields {
|
||||
|
||||
Reference in New Issue
Block a user