Skip to content

Commit

Permalink
feat: add max concurrent git processes (#936)
Browse files Browse the repository at this point in the history
  • Loading branch information
harishv7 authored Sep 6, 2023
1 parent ae722b9 commit 127f5b1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/constants/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "[email protected]"
export const ISOMER_SUPPORT_EMAIL = "[email protected]"

export const MAX_CONCURRENT_GIT_PROCESSES = 150
6 changes: 5 additions & 1 deletion src/middleware/routeHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 5 additions & 1 deletion src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 127f5b1

Please sign in to comment.