From e5d7663521467f81d3c367b9f40bd9e2dcbba4ce Mon Sep 17 00:00:00 2001 From: ghe Date: Fri, 16 Dec 2022 10:21:34 +0000 Subject: [PATCH 1/2] fix: reduce concurrency to fix max callstack size error --- src/scripts/sync/sync-org-projects.ts | 2 +- src/scripts/sync/sync-projects-per-target.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scripts/sync/sync-org-projects.ts b/src/scripts/sync/sync-org-projects.ts index 574e0f8d..300ed9cb 100644 --- a/src/scripts/sync/sync-org-projects.ts +++ b/src/scripts/sync/sync-org-projects.ts @@ -186,7 +186,7 @@ export async function updateTargets( const failedProjects: ProjectUpdateFailure[] = []; const loggingPath = getLoggingPath(); - const concurrentTargets = 100; + const concurrentTargets = 30; await pMap( targets, diff --git a/src/scripts/sync/sync-projects-per-target.ts b/src/scripts/sync/sync-projects-per-target.ts index 9bc06a85..aa19a218 100644 --- a/src/scripts/sync/sync-projects-per-target.ts +++ b/src/scripts/sync/sync-projects-per-target.ts @@ -269,7 +269,7 @@ export async function bulkDeactivateProjects( ); } }, - { concurrency: 100 }, + { concurrency: 50 }, ); return { updated, failed }; From 5d2b2fc96369462dd7648e3a50d9d4a7e47d4872 Mon Sep 17 00:00:00 2001 From: ghe Date: Fri, 16 Dec 2022 10:22:19 +0000 Subject: [PATCH 2/2] chore: move defaultExclusionGlobs to common lib --- src/common.ts | 12 ++++++++++++ src/scripts/sync/clone-and-analyze.ts | 12 +----------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/common.ts b/src/common.ts index 3b200b1d..8399e36d 100644 --- a/src/common.ts +++ b/src/common.ts @@ -23,3 +23,15 @@ export const targetProps = [ 'branch', ]; export const targetPropsWithId = [...targetProps, 'id']; + +export const defaultExclusionGlobs = [ + 'fixtures', + 'tests', + '__tests__', + 'test', + '__test__', + 'ci', + 'node_modules', + 'bower_components', + '.git', +]; diff --git a/src/scripts/sync/clone-and-analyze.ts b/src/scripts/sync/clone-and-analyze.ts index 89164f53..bdd4a017 100644 --- a/src/scripts/sync/clone-and-analyze.ts +++ b/src/scripts/sync/clone-and-analyze.ts @@ -1,6 +1,7 @@ import * as debugLib from 'debug'; import * as fs from 'fs'; import * as path from 'path'; +import { defaultExclusionGlobs } from '../../common'; import { find, getSCMSupportedManifests, gitClone } from '../../lib'; import type { SnykProductEntitlement } from '../../lib/supported-project-types/supported-manifests'; @@ -14,17 +15,6 @@ import { generateProjectDiffActions } from './generate-projects-diff-actions'; const debug = debugLib('snyk:clone-and-analyze'); -const defaultExclusionGlobs = [ - 'fixtures', - 'tests', - '__tests__', - 'test', - '__test__', - 'ci', - 'node_modules', - 'bower_components', - '.git', -]; export async function cloneAndAnalyze( integrationType: SupportedIntegrationTypesUpdateProject, repoMetadata: RepoMetaData,