Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
skyrpex committed Jul 23, 2024
1 parent ab9f389 commit 9904a36
Showing 1 changed file with 10 additions and 32 deletions.
42 changes: 10 additions & 32 deletions libs/wingsdk/src/simulator/lockfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ export class Lockfile {
private timeout: NodeJS.Timeout | undefined;
private lastMtime: number | undefined;
private compromised = false;
// private releasing = false;
// private lastTask: Promise<void> | undefined;
private onCompromised?: (
reason: string,
error?: unknown
Expand All @@ -50,16 +48,6 @@ export class Lockfile {
return;
}

// if (this.releasing) {
// throw new Error(
// "Cannot lock the lockfile while it's being released. Please wait for the release to complete."
// );
// }

// this.lastTask = new Promise(() => {

// });

this.compromised = false;

fs.mkdirSync(path.dirname(this.path), { recursive: true });
Expand Down Expand Up @@ -151,28 +139,18 @@ export class Lockfile {
return;
}

// if (this.releasing) {
// return;
// }

try {
// this.releasing = true;

clearTimeout(this.timeout);
this.timeout = undefined;
clearTimeout(this.timeout);
this.timeout = undefined;

fs.closeSync(this.lockfile);
this.lockfile = undefined;
this.lastMtime = undefined;
fs.closeSync(this.lockfile);
this.lockfile = undefined;
this.lastMtime = undefined;

// If the lockfile was compromised, we won't remove
// it since it belongs to another process now.
if (!this.compromised) {
fs.rmSync(this.path, { force: true });
this.compromised = false;
}
} finally {
// this.releasing = false;
// If the lockfile was compromised, we won't remove
// it since it belongs to another process now.
if (!this.compromised) {
fs.rmSync(this.path, { force: true });
this.compromised = false;
}
}

Expand Down

0 comments on commit 9904a36

Please sign in to comment.