Skip to content

Commit be7759a

Browse files
committed
fix(pullRemote): restore concurrent request check and directory cleanup on error
1 parent a56700f commit be7759a

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/proxy/processors/push-action/PullRemoteBase.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ export abstract class PullRemoteBase {
2424
*/
2525
protected async setupDirectories(action: Action): Promise<void> {
2626
action.proxyGitPath = `${PullRemoteBase.REMOTE_DIR}/${action.id}`;
27+
28+
if (fs.existsSync(action.proxyGitPath)) {
29+
throw new Error(
30+
'The checkout folder already exists - we may be processing a concurrent request for this push. If this issue persists the proxy may need to be restarted.',
31+
);
32+
}
33+
2734
await this.ensureDirectory(PullRemoteBase.REMOTE_DIR);
2835
await this.ensureDirectory(action.proxyGitPath);
2936
}
@@ -54,6 +61,13 @@ export abstract class PullRemoteBase {
5461
} catch (e: any) {
5562
const message = e instanceof Error ? e.message : (e?.toString?.('utf-8') ?? String(e));
5663
step.setError(message);
64+
65+
// Clean up the checkout folder so it doesn't block subsequent attempts
66+
if (action.proxyGitPath && fs.existsSync(action.proxyGitPath)) {
67+
fs.rmSync(action.proxyGitPath, { recursive: true, force: true });
68+
step.log('.remote is deleted!');
69+
}
70+
5771
throw e;
5872
} finally {
5973
action.addStep(step);

0 commit comments

Comments
 (0)