less chatter, pub check

This commit is contained in:
hatim boufnichel 2021-04-21 22:35:38 +02:00
parent d4cc93d39b
commit 9f31d8ef9c
2 changed files with 19 additions and 6 deletions

View file

@ -120,8 +120,9 @@ const tryAndWait = async (promGen, shouldRetry = () => false) => {
if (shouldRetry(resolvedValue)) {
logger.info(
'force retrying' +
'force retrying' /* +
` args: ${promGen.toString()} -- ${shouldRetry.toString()} \n resolvedValue: ${resolvedValue}, type: ${typeof resolvedValue}`
*/
)
} else {
return resolvedValue
@ -135,8 +136,9 @@ const tryAndWait = async (promGen, shouldRetry = () => false) => {
}
logger.info(
`\n retrying \n` +
`\n retrying \n` /* +
` args: ${promGen.toString()} -- ${shouldRetry.toString()}`
*/
)
await delay(200)
@ -151,8 +153,9 @@ const tryAndWait = async (promGen, shouldRetry = () => false) => {
if (shouldRetry(resolvedValue)) {
logger.info(
'force retrying' +
'force retrying' /* +
` args: ${promGen.toString()} -- ${shouldRetry.toString()} \n resolvedValue: ${resolvedValue}, type: ${typeof resolvedValue}`
*/
)
} else {
return resolvedValue
@ -165,8 +168,9 @@ const tryAndWait = async (promGen, shouldRetry = () => false) => {
}
logger.info(
`\n retrying \n` +
`\n retrying \n` /* +
` args: ${promGen.toString()} -- ${shouldRetry.toString()}`
*/
)
await delay(3000)
@ -181,8 +185,9 @@ const tryAndWait = async (promGen, shouldRetry = () => false) => {
if (shouldRetry(resolvedValue)) {
logger.info(
'force retrying' +
'force retrying' /* +
` args: ${promGen.toString()} -- ${shouldRetry.toString()} \n resolvedValue: ${resolvedValue}, type: ${typeof resolvedValue}`
*/
)
} else {
return resolvedValue
@ -195,8 +200,9 @@ const tryAndWait = async (promGen, shouldRetry = () => false) => {
}
logger.info(
`\n NOT recreating a fresh gun but retrying one last time \n` +
`\n NOT recreating a fresh gun but retrying one last time \n` /* +
` args: ${promGen.toString()} -- ${shouldRetry.toString()}`
*/
)
const { gun, user } = require('../../Mediator/index').freshGun()

View file

@ -3160,6 +3160,13 @@ module.exports = async (
const publicKeyForDecryption = req.header(PUBKEY_FOR_DECRYPT_HEADER)
const { path, publicKey, type } = req.params
if (!publicKey || publicKey === 'undefined') {
res.status(400).json({
errorMessage: 'Invalid publicKey specified'
})
return
}
if (!allowedTypes.includes(type)) {
res.status(400).json({
errorMessage: 'Invalid type specified'