From 327f5ee9fe6a256030c038530e2b6899a11173f5 Mon Sep 17 00:00:00 2001 From: Daniel Lugo Date: Sat, 15 Feb 2020 14:20:38 -0400 Subject: [PATCH] don't debounce, only sub once --- services/gunDB/Mediator/index.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/services/gunDB/Mediator/index.js b/services/gunDB/Mediator/index.js index f14129c1..633eb900 100644 --- a/services/gunDB/Mediator/index.js +++ b/services/gunDB/Mediator/index.js @@ -913,6 +913,8 @@ class Mediator { } } + onSentRequestsSubbed = false + /** * @param {Readonly<{ token: string }>} body */ @@ -922,16 +924,18 @@ class Mediator { await throwOnInvalidToken(token) - API.Events.onSimplerSentRequests( - debounce(sentRequests => { + if (!this.onSentRequestsSubbed) { + this.onSentRequestsSubbed = true + + API.Events.onSimplerSentRequests(sentRequests => { console.log(`new Reqss in mediator: ${JSON.stringify(sentRequests)}`) this.socket.emit(Event.ON_SENT_REQUESTS, { msg: sentRequests, ok: true, origBody: body }) - }, 1000) - ) + }) + } } catch (err) { console.log(err) this.socket.emit(Event.ON_SENT_REQUESTS, {