@jsenv/server
Advanced tools
Comparing version 2.3.0 to 2.3.1
{ | ||
"name": "@jsenv/server", | ||
"version": "2.3.0", | ||
"version": "2.3.1", | ||
"description": "High level api for node.js server.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -44,2 +44,4 @@ /* eslint-disable import/max-dependencies */ | ||
const requestTooLongWarningTimeout = 10000 | ||
export const startServer = async ({ | ||
@@ -381,3 +383,17 @@ cancellationToken = createCancellationToken(), | ||
const responseProperties = await requestToResponse(request) | ||
const responsePropertiesPromise = Promise.resolve(requestToResponse(request)) | ||
const timeout = setTimeout(() => { | ||
logger.warn( | ||
`still no response found for ${request.url} after ${requestTooLongWarningTimeout} ms`, | ||
) | ||
}, requestTooLongWarningTimeout) | ||
responsePropertiesPromise.then( | ||
() => { | ||
clearTimeout(timeout) | ||
}, | ||
() => { | ||
clearTimeout(timeout) | ||
}, | ||
) | ||
const responseProperties = await responsePropertiesPromise | ||
return { | ||
@@ -384,0 +400,0 @@ response: responsePropertiesToResponse(responseProperties || {}), |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
239150
4436