This commit is contained in:
Daniel Lugo 2020-02-15 16:09:46 -04:00
parent fa8c184b6b
commit f1f65fe074

View file

@ -6,6 +6,7 @@ const Gun = require('gun')
require('gun/lib/open') require('gun/lib/open')
const debounce = require('lodash/debounce') const debounce = require('lodash/debounce')
const Encryption = require('../../../utils/encryptionStore') const Encryption = require('../../../utils/encryptionStore')
const logger = require('winston')
/** @type {import('../contact-api/SimpleGUN').ISEA} */ /** @type {import('../contact-api/SimpleGUN').ISEA} */
// @ts-ignore // @ts-ignore
@ -412,6 +413,7 @@ class Mediator {
socket.emit(eventName, encryptedMessage) socket.emit(eventName, encryptedMessage)
} catch (err) { } catch (err) {
logger.error(err.message)
console.error(err) console.error(err)
} }
} }
@ -927,14 +929,18 @@ class Mediator {
if (!this.onSentRequestsSubbed) { if (!this.onSentRequestsSubbed) {
this.onSentRequestsSubbed = true this.onSentRequestsSubbed = true
API.Events.onSimplerSentRequests(sentRequests => { API.Events.onSimplerSentRequests(
console.log(`new Reqss in mediator: ${JSON.stringify(sentRequests)}`) debounce(sentRequests => {
this.socket.emit(Event.ON_SENT_REQUESTS, { console.log(
msg: sentRequests, `new Reqss in mediator: ${JSON.stringify(sentRequests)}`
ok: true, )
origBody: body this.socket.emit(Event.ON_SENT_REQUESTS, {
}) msg: sentRequests,
}) ok: true,
origBody: body
})
}, 1000)
)
} }
} catch (err) { } catch (err) {
console.log(err) console.log(err)