개선관리 요구사항과 Google 로그인을 완료
This commit is contained in:
parent
cc0a15b7c6
commit
2a39636163
112 changed files with 10166 additions and 527 deletions
|
|
@ -28,10 +28,9 @@ function uniqueE2EEmail(prefix: string, domain: string) {
|
|||
return `${prefix}.${Date.now()}.${e2eEmailCounter}@${domain}`;
|
||||
}
|
||||
|
||||
export async function withGlobalEngineConfigLock<T>(
|
||||
export async function acquireGlobalEngineConfigLock(
|
||||
label: string,
|
||||
action: () => Promise<T>,
|
||||
): Promise<T> {
|
||||
): Promise<() => Promise<void>> {
|
||||
const dir = path.join(process.cwd(), "node_modules", ".tmp");
|
||||
const lockPath = path.join(dir, "engine-config.lock");
|
||||
const startedAt = Date.now();
|
||||
|
|
@ -43,11 +42,18 @@ export async function withGlobalEngineConfigLock<T>(
|
|||
const handle = await fs.open(lockPath, "wx");
|
||||
try {
|
||||
await handle.writeFile(`${process.pid} ${label} ${new Date().toISOString()}`);
|
||||
return await action();
|
||||
} finally {
|
||||
} catch (err) {
|
||||
await handle.close().catch(() => undefined);
|
||||
await fs.unlink(lockPath).catch(() => undefined);
|
||||
throw err;
|
||||
}
|
||||
let released = false;
|
||||
return async () => {
|
||||
if (released) return;
|
||||
released = true;
|
||||
await handle.close().catch(() => undefined);
|
||||
await fs.unlink(lockPath).catch(() => undefined);
|
||||
};
|
||||
} catch (err) {
|
||||
const code =
|
||||
typeof err === "object" && err !== null && "code" in err
|
||||
|
|
@ -68,6 +74,18 @@ export async function withGlobalEngineConfigLock<T>(
|
|||
}
|
||||
}
|
||||
|
||||
export async function withGlobalEngineConfigLock<T>(
|
||||
label: string,
|
||||
action: () => Promise<T>,
|
||||
): Promise<T> {
|
||||
const release = await acquireGlobalEngineConfigLock(label);
|
||||
try {
|
||||
return await action();
|
||||
} finally {
|
||||
await release();
|
||||
}
|
||||
}
|
||||
|
||||
const E2E_COHORT_ID = "e2e-hanshin";
|
||||
|
||||
export async function signInAsLearner(page: Page) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue