From b5d2fc6c11c068daacaf6c865078116817c8aff5 Mon Sep 17 00:00:00 2001 From: Daniel Lugo Date: Mon, 22 Jun 2020 17:45:45 +0100 Subject: [PATCH] garbage collect gun --- services/gunDB/Mediator/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/services/gunDB/Mediator/index.js b/services/gunDB/Mediator/index.js index 2b91bae7..cd15c802 100644 --- a/services/gunDB/Mediator/index.js +++ b/services/gunDB/Mediator/index.js @@ -328,6 +328,17 @@ const logoff = () => { } const instantiateGun = () => { + if (user) { + user.leave() + } + // @ts-ignore + user = null + if (gun) { + gun.off() + } + // @ts-ignore + gun = null + const _gun = /** @type {unknown} */ (new Gun({ axe: false, peers: Config.PEERS