mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 09:09:36 +02:00
Merge pull request #32395 from overleaf/ar-more-information-on-long-requests
[fetch-utils] more information on long requests GitOrigin-RevId: 716620fa95fcfbe563ad0a3728cebd09509b03f5
This commit is contained in:
@@ -188,16 +188,25 @@ function parseOpts(opts, url) {
|
|||||||
if (opts.signal) {
|
if (opts.signal) {
|
||||||
detachSignal = abortOnSignal(abortController, opts.signal)
|
detachSignal = abortOnSignal(abortController, opts.signal)
|
||||||
} else {
|
} else {
|
||||||
|
let overTimeoutStart
|
||||||
|
const stack = new Error().stack
|
||||||
const timeout = setTimeout(() => {
|
const timeout = setTimeout(() => {
|
||||||
if (logger) {
|
overTimeoutStart = process.hrtime.bigint()
|
||||||
logger.warn(
|
|
||||||
{ url, method: opts.method ?? 'GET' },
|
|
||||||
'Fetch request did not complete within 120 seconds'
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}, 120000)
|
}, 120000)
|
||||||
detachSignal = () => {
|
detachSignal = () => {
|
||||||
clearTimeout(timeout)
|
clearTimeout(timeout)
|
||||||
|
if (overTimeoutStart && logger) {
|
||||||
|
logger.warn(
|
||||||
|
{
|
||||||
|
url,
|
||||||
|
method: opts.method ?? 'GET',
|
||||||
|
overTimeoutMs:
|
||||||
|
Number(process.hrtime.bigint() - overTimeoutStart) / 1e6,
|
||||||
|
stack,
|
||||||
|
},
|
||||||
|
'Fetch request did not complete within 120 seconds'
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (opts.body instanceof Readable) {
|
if (opts.body instanceof Readable) {
|
||||||
|
|||||||
Reference in New Issue
Block a user