log data before sending
This commit is contained in:
parent
dd3b16832b
commit
76ecb6b9a9
2 changed files with 16 additions and 6 deletions
|
|
@ -34,8 +34,9 @@ const timeout10 = promise => {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
let timeoutID
|
let timeoutID
|
||||||
return Promise.race([
|
return Promise.race([
|
||||||
promise.then(() => {
|
promise.then((v) => {
|
||||||
clearTimeout(timeoutID)
|
clearTimeout(timeoutID)
|
||||||
|
return v
|
||||||
}),
|
}),
|
||||||
|
|
||||||
new Promise((_, rej) => {
|
new Promise((_, rej) => {
|
||||||
|
|
@ -56,8 +57,9 @@ const timeout5 = promise => {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
let timeoutID
|
let timeoutID
|
||||||
return Promise.race([
|
return Promise.race([
|
||||||
promise.then(() => {
|
promise.then((v) => {
|
||||||
clearTimeout(timeoutID)
|
clearTimeout(timeoutID)
|
||||||
|
return v
|
||||||
}),
|
}),
|
||||||
|
|
||||||
new Promise((_, rej) => {
|
new Promise((_, rej) => {
|
||||||
|
|
|
||||||
|
|
@ -1625,8 +1625,10 @@ module.exports = async (
|
||||||
|
|
||||||
app.get(`/api/gun/${GunEvent.ON_AVATAR}`, async (_, res) => {
|
app.get(`/api/gun/${GunEvent.ON_AVATAR}`, async (_, res) => {
|
||||||
try {
|
try {
|
||||||
|
const data = await timeout5(user.get(Key.PROFILE).get(Key.AVATAR).then())
|
||||||
|
logger.info(`avatar poll:${data}`)
|
||||||
res.json({
|
res.json({
|
||||||
data: await timeout5(user.get(Key.PROFILE).get(Key.AVATAR).then())
|
data
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.info('Error in Avatar poll:')
|
logger.info('Error in Avatar poll:')
|
||||||
|
|
@ -1639,8 +1641,10 @@ module.exports = async (
|
||||||
|
|
||||||
app.get(`/api/gun/${GunEvent.ON_DISPLAY_NAME}`, async (_, res) => {
|
app.get(`/api/gun/${GunEvent.ON_DISPLAY_NAME}`, async (_, res) => {
|
||||||
try {
|
try {
|
||||||
|
const data = await timeout5(user.get(Key.PROFILE).get(Key.DISPLAY_NAME).then())
|
||||||
|
logger.info(`display name poll:${data}`)
|
||||||
res.json({
|
res.json({
|
||||||
data: await timeout5(user.get(Key.PROFILE).get(Key.DISPLAY_NAME).then())
|
data
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.info('Error in Display Name poll:')
|
logger.info('Error in Display Name poll:')
|
||||||
|
|
@ -1653,8 +1657,10 @@ module.exports = async (
|
||||||
|
|
||||||
app.get(`/api/gun/${GunEvent.ON_HANDSHAKE_ADDRESS}`, async (_, res) => {
|
app.get(`/api/gun/${GunEvent.ON_HANDSHAKE_ADDRESS}`, async (_, res) => {
|
||||||
try {
|
try {
|
||||||
|
const data = await timeout5(user.get(Key.CURRENT_HANDSHAKE_ADDRESS).then())
|
||||||
|
logger.info(`handshake address poll:${data}`)
|
||||||
res.json({
|
res.json({
|
||||||
data: await timeout5(user.get(Key.CURRENT_HANDSHAKE_ADDRESS).then())
|
data
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.info('Error in Handshake Address poll:')
|
logger.info('Error in Handshake Address poll:')
|
||||||
|
|
@ -1667,8 +1673,10 @@ module.exports = async (
|
||||||
|
|
||||||
app.get(`/api/gun/${GunEvent.ON_BIO}`, async (_, res) => {
|
app.get(`/api/gun/${GunEvent.ON_BIO}`, async (_, res) => {
|
||||||
try {
|
try {
|
||||||
|
const data = await timeout5(user.get(Key.BIO).then())
|
||||||
|
console.log(data)
|
||||||
res.json({
|
res.json({
|
||||||
data: await timeout5(user.get(Key.BIO).then())
|
data
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.info('Error in BIO poll:')
|
logger.info('Error in BIO poll:')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue