chore: adjust safeCatch timeout

This commit is contained in:
Ben Allfree 2023-01-23 15:07:26 +00:00
parent e1ce83efb5
commit 63841389bc

View File

@ -4,7 +4,8 @@ import { logger } from './Logger'
let c = 0 let c = 0
export const safeCatch = <TIn extends any[], TOut>( export const safeCatch = <TIn extends any[], TOut>(
name: string, name: string,
cb: (...args: TIn) => Promise<TOut> cb: (...args: TIn) => Promise<TOut>,
timeoutMs = 5000
) => { ) => {
return (...args: TIn) => { return (...args: TIn) => {
const _c = c++ const _c = c++
@ -13,8 +14,8 @@ export const safeCatch = <TIn extends any[], TOut>(
const { raw, error, warn } = logger().create(pfx) const { raw, error, warn } = logger().create(pfx)
raw(`args`, args) raw(`args`, args)
const tid = setTimeout(() => { const tid = setTimeout(() => {
warn(`timeout waiting for ${pfx}`) error(`timeout ${timeoutMs}ms waiting for ${pfx}`)
}, 100) }, timeoutMs)
return cb(...args) return cb(...args)
.then((res) => { .then((res) => {