-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1164 from isomerpages/release/0.67.1
Release/0.67.1
- Loading branch information
Showing
5 changed files
with
15 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,15 +10,12 @@ import { ResultAsync, errAsync, fromPromise, okAsync } from "neverthrow" | |
|
||
import { config } from "@config/config" | ||
|
||
import { lock, unlock } from "@utils/mutex-utils" | ||
|
||
import { | ||
EFS_VOL_PATH_STAGING, | ||
EFS_VOL_PATH_STAGING_LITE, | ||
} from "@root/constants" | ||
import GitFileSystemError from "@root/errors/GitFileSystemError" | ||
import InitializationError from "@root/errors/InitializationError" | ||
import LockedError from "@root/errors/LockedError" | ||
import { consoleLogger } from "@root/logger/console.logger" | ||
import logger from "@root/logger/logger" | ||
import { attachFormSGHandler } from "@root/middleware" | ||
|
@@ -117,20 +114,15 @@ export class FormsgGGsRepairRouter { | |
} | ||
|
||
handleGGsFormSubmission = (repoNames: string[], requesterEmail: string) => { | ||
const repairs: ResultAsync<string, GitFileSystemError | LockedError>[] = [] | ||
const repairs: ResultAsync<string, GitFileSystemError>[] = [] | ||
|
||
const clonedStagingRepos: string[] = [] | ||
const syncedStagingAndStagingLiteRepos: string[] = [] | ||
const LOCK_TIME_SECONDS = 15 * 60 // 15 minutes | ||
repoNames.forEach((repoName) => { | ||
const repoUrl = `[email protected]:isomerpages/${repoName}.git` | ||
|
||
repairs.push( | ||
ResultAsync.fromPromise( | ||
lock(repoName, LOCK_TIME_SECONDS), | ||
(err) => new LockedError(`Unable to lock repo ${repoName}`) | ||
) | ||
.andThen(() => this.doesRepoNeedClone(repoName)) | ||
this.doesRepoNeedClone(repoName) | ||
.andThen(() => { | ||
const isStaging = true | ||
return ( | ||
|
@@ -174,15 +166,6 @@ export class FormsgGGsRepairRouter { | |
return okAsync(result) | ||
}) | ||
) | ||
.andThen((result) => { | ||
// Failure to unlock is not blocking | ||
ResultAsync.fromPromise(unlock(repoName), () => { | ||
logger.error( | ||
"Failed to unlock repo - repo will unlock after at most 15 min" | ||
) | ||
}) | ||
return okAsync(result) | ||
}) | ||
) | ||
}) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters