diff --git a/packages/backend/src/nest/ipfs/ipfs.service.ts b/packages/backend/src/nest/ipfs/ipfs.service.ts index 49f77f0454..3dfade7410 100644 --- a/packages/backend/src/nest/ipfs/ipfs.service.ts +++ b/packages/backend/src/nest/ipfs/ipfs.service.ts @@ -151,7 +151,15 @@ export class IpfsService { await this.blockstore?.db.close() await this.blockstore?.close() await this.datastore?.close() - await this.ipfsInstance.stop() + + try { + await this.ipfsInstance?.stop() + } catch (e) { + if ((e as Error).message !== 'Database is not open') { + this.logger.error(`Error while closing IPFS instance`, e) + throw e + } + } this.started = false } diff --git a/packages/backend/src/nest/libp2p/libp2p.service.ts b/packages/backend/src/nest/libp2p/libp2p.service.ts index 720a429665..986f9d8bc8 100644 --- a/packages/backend/src/nest/libp2p/libp2p.service.ts +++ b/packages/backend/src/nest/libp2p/libp2p.service.ts @@ -387,7 +387,7 @@ export class Libp2pService extends EventEmitter { clearTimeout(this.redialTimeout) await this.hangUpPeers() await this.libp2pInstance?.stop() - await this.libp2pDatastore.close() + await this.libp2pDatastore?.close() this.libp2pInstance = null this.connectedPeers = new Map()