diff --git a/src/constants/constants.ts b/src/constants/constants.ts index 2fe21a4c0..10672f96c 100644 --- a/src/constants/constants.ts +++ b/src/constants/constants.ts @@ -61,3 +61,5 @@ export const DNS_INDIRECTION_DOMAIN = "hostedon.isomer.gov.sg" export const DNS_INDIRECTION_REPO = "isomer-indirection" export const ISOMER_ADMIN_EMAIL = "admin@isomer.gov.sg" export const ISOMER_SUPPORT_EMAIL = "support@isomer.gov.sg" + +export const MAX_CONCURRENT_GIT_PROCESSES = 150 diff --git a/src/middleware/routeHandler.js b/src/middleware/routeHandler.js index f2f00c639..a52b48cc5 100644 --- a/src/middleware/routeHandler.js +++ b/src/middleware/routeHandler.js @@ -10,6 +10,8 @@ const { default: GithubSessionData } = require("@classes/GithubSessionData") const { lock, unlock } = require("@utils/mutex-utils") const { getCommitAndTreeSha, revertCommit } = require("@utils/utils.js") +const { MAX_CONCURRENT_GIT_PROCESSES } = require("@constants/constants") + const { FEATURE_FLAGS } = require("@root/constants/featureFlags") const GitFileSystemError = require("@root/errors/GitFileSystemError").default const LockedError = require("@root/errors/LockedError").default @@ -19,7 +21,9 @@ const { const BRANCH_REF = config.get("github.branchRef") -const gitFileSystemService = new GitFileSystemService(new SimpleGit()) +const gitFileSystemService = new GitFileSystemService( + new SimpleGit({ maxConcurrentProcesses: MAX_CONCURRENT_GIT_PROCESSES }) +) const isRepoWhitelisted = (siteName, ggsWhitelistedRepos) => { // TODO: adding log to simplify debugging, to be removed after stabilising diff --git a/src/server.js b/src/server.js index 728153892..9e53bddc5 100644 --- a/src/server.js +++ b/src/server.js @@ -12,6 +12,8 @@ import { config } from "@config/config" import logger from "@logger/logger" +import { MAX_CONCURRENT_GIT_PROCESSES } from "@constants/constants" + import initSequelize from "@database/index" import { Site, @@ -155,7 +157,9 @@ const { AuthService } = require("@services/utilServices/AuthService") setBrowserPolyfills() const authService = new AuthService({ usersService }) -const gitFileSystemService = new GitFileSystemService(new simpleGit()) +const gitFileSystemService = new GitFileSystemService( + new simpleGit({ maxConcurrentProcesses: MAX_CONCURRENT_GIT_PROCESSES }) +) const gitHubService = new RepoService( isomerRepoAxiosInstance, gitFileSystemService