Skip to content

Commit

Permalink
Fix backend tests
Browse files Browse the repository at this point in the history
  • Loading branch information
islathehut committed Dec 10, 2024
1 parent 91ea597 commit 5f8a15b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion packages/backend/src/nest/ipfs/ipfs.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/nest/libp2p/libp2p.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 5f8a15b

Please sign in to comment.