Skip to content

Commit

Permalink
fix repo.lock cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jdeepee committed Mar 27, 2023
1 parent 007b537 commit 5dccb1f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions executor/src/core/PerspectivismCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ export default class PerspectivismCore {

async initIPFS(params: InitIPFSParams) {
console.log("Init IPFS service with port ", params.ipfsSwarmPort, " at path: ", params.ipfsRepoPath);
let repoPath = params.ipfsRepoPath ? path.join(params.ipfsRepoPath, "ipfs", "repo.lock") : path.join(this.#config.dataPath, "ipfs", "repo.lock")
let basePath = params.ipfsRepoPath ? params.ipfsRepoPath : path.join(this.#config.dataPath, "ipfs");
let repoPath = path.join(basePath, "repo.lock");
console.log("Check if repo.lock exists at: ", repoPath);

let retries = 0;
Expand All @@ -149,7 +150,7 @@ export default class PerspectivismCore {
if (retries > 10) {
console.log("Waited long enough for repo.lock to be released, deleting...");
fs.rmdirSync(repoPath, { recursive: true });
fs.rmSync(path.join(this.#config.dataPath, "ipfs", "datastore", "LOCK"));
fs.rmSync(path.join(basePath, "datastore", "LOCK"));
}
}

Expand Down

0 comments on commit 5dccb1f

Please sign in to comment.