debounce, remove console logs
This commit is contained in:
parent
7bc7ad35ef
commit
a4f4769989
2 changed files with 20 additions and 26 deletions
|
|
@ -372,16 +372,9 @@ class Mediator {
|
|||
console.error('Unknown Device', error)
|
||||
return false
|
||||
}
|
||||
console.log('Emitting Data...', data)
|
||||
if (typeof data === 'string') {
|
||||
data = JSON.parse(data)
|
||||
}
|
||||
console.log('Event:', eventName)
|
||||
console.log('Data:', data)
|
||||
console.log('Decrypt params:', {
|
||||
deviceId,
|
||||
message: data.encryptedKey
|
||||
})
|
||||
const decryptedKey = Encryption.decryptKey({
|
||||
deviceId,
|
||||
message: data.encryptedKey
|
||||
|
|
@ -415,7 +408,7 @@ class Mediator {
|
|||
deviceId
|
||||
})
|
||||
: data
|
||||
console.log('Sending Message...', eventName, data, encryptedMessage)
|
||||
|
||||
socket.emit(eventName, encryptedMessage)
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
|
|
@ -928,7 +921,8 @@ class Mediator {
|
|||
|
||||
await throwOnInvalidToken(token)
|
||||
|
||||
await API.Events.onSimplerSentRequests(sentRequests => {
|
||||
await API.Events.onSimplerSentRequests(
|
||||
debounce(sentRequests => {
|
||||
if (Config.SHOW_LOG) {
|
||||
console.log('---sentRequests---')
|
||||
console.log(sentRequests)
|
||||
|
|
@ -940,7 +934,8 @@ class Mediator {
|
|||
ok: true,
|
||||
origBody: body
|
||||
})
|
||||
})
|
||||
}, 200)
|
||||
)
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
this.socket.emit(Event.ON_SENT_REQUESTS, {
|
||||
|
|
|
|||
|
|
@ -514,6 +514,11 @@ const sendHandshakeRequest = async (recipientPublicKey, gun, user, SEA) => {
|
|||
timestamp
|
||||
}
|
||||
|
||||
const encryptedForMeRecipientPublicKey = await SEA.encrypt(
|
||||
recipientPublicKey,
|
||||
mySecret
|
||||
)
|
||||
|
||||
console.log('sendHR() -> before newHandshakeRequestID')
|
||||
/** @type {string} */
|
||||
const newHandshakeRequestID = await new Promise((res, rej) => {
|
||||
|
|
@ -542,14 +547,8 @@ const sendHandshakeRequest = async (recipientPublicKey, gun, user, SEA) => {
|
|||
})
|
||||
})
|
||||
|
||||
const encryptedForMeRecipientPublicKey = await SEA.encrypt(
|
||||
recipientPublicKey,
|
||||
mySecret
|
||||
)
|
||||
|
||||
// This needs to come before the write to sent requests. Because that write
|
||||
// triggers Jobs.onAcceptedRequests and it in turn reads from request-to-user
|
||||
// This also triggers Events.onSimplerSentRequests
|
||||
|
||||
/**
|
||||
* @type {StoredReq}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue