|
|
@@ -188,16 +188,25 @@ function parseOpts(opts, url) {
|
|
|
if (opts.signal) {
|
|
|
detachSignal = abortOnSignal(abortController, opts.signal)
|
|
|
} else {
|
|
|
+ let overTimeoutStart
|
|
|
+ const stack = new Error().stack
|
|
|
const timeout = setTimeout(() => {
|
|
|
- if (logger) {
|
|
|
+ overTimeoutStart = process.hrtime.bigint()
|
|
|
+ }, 120000)
|
|
|
+ detachSignal = () => {
|
|
|
+ clearTimeout(timeout)
|
|
|
+ if (overTimeoutStart && logger) {
|
|
|
logger.warn(
|
|
|
- { url, method: opts.method ?? 'GET' },
|
|
|
+ {
|
|
|
+ url,
|
|
|
+ method: opts.method ?? 'GET',
|
|
|
+ overTimeoutMs:
|
|
|
+ Number(process.hrtime.bigint() - overTimeoutStart) / 1e6,
|
|
|
+ stack,
|
|
|
+ },
|
|
|
'Fetch request did not complete within 120 seconds'
|
|
|
)
|
|
|
}
|
|
|
- }, 120000)
|
|
|
- detachSignal = () => {
|
|
|
- clearTimeout(timeout)
|
|
|
}
|
|
|
}
|
|
|
if (opts.body instanceof Readable) {
|