From 488c5d3c22121d54e0e02e82cd2805649b7aabec Mon Sep 17 00:00:00 2001 From: Chris Troutner Date: Sat, 4 Sep 2021 17:51:27 -0700 Subject: [PATCH] fix(app): Exiting app if IPFS lock file is being held --- src/adapters/ipfs/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/adapters/ipfs/index.js b/src/adapters/ipfs/index.js index 1fd7fb8..320fb87 100644 --- a/src/adapters/ipfs/index.js +++ b/src/adapters/ipfs/index.js @@ -38,6 +38,13 @@ class IPFS { return true } catch (err) { console.error('Error in adapters/ipfs/index.js/start()') + + // If error is due to a lock file issue. Kill the process, so that + // Docker or pm2 has a chance to restart the service. + if (err.message.includes('Lock already being held')) { + process.exit(1) + } + throw err } }