@middy/core
Advanced tools
Comparing version 4.0.10 to 4.1.0
@@ -76,2 +76,3 @@ import { setTimeout } from 'node:timers/promises'; | ||
const runRequest = async (request, beforeMiddlewares, lambdaHandler, afterMiddlewares, onErrorMiddlewares, plugin)=>{ | ||
let timeoutAbort; | ||
const timeoutEarly = plugin.timeoutEarly && request.context.getRemainingTimeInMillis; | ||
@@ -83,3 +84,2 @@ try { | ||
const handlerAbort = new AbortController(); | ||
let timeoutAbort; | ||
if (timeoutEarly) timeoutAbort = new AbortController(); | ||
@@ -90,3 +90,3 @@ request.response = await Promise.race([ | ||
}), | ||
timeoutEarly ? setTimeout(request.context.getRemainingTimeInMillis() - plugin.timeoutEarlyInMillis, { | ||
timeoutEarly ? setTimeout(request.context.getRemainingTimeInMillis() - plugin.timeoutEarlyInMillis, undefined, { | ||
signal: timeoutAbort.signal | ||
@@ -98,3 +98,3 @@ }).then(()=>{ | ||
]); | ||
if (timeoutEarly) timeoutAbort.abort(); | ||
timeoutAbort?.abort(); | ||
plugin.afterHandler?.(); | ||
@@ -104,2 +104,3 @@ await runMiddlewares(request, afterMiddlewares, plugin); | ||
} catch (e1) { | ||
timeoutAbort?.abort(); | ||
request.response = undefined; | ||
@@ -106,0 +107,0 @@ request.error = e1; |
{ | ||
"name": "@middy/core", | ||
"version": "4.0.10", | ||
"version": "4.1.0", | ||
"description": "🛵 The stylish Node.js middleware engine for AWS Lambda (core package)", | ||
@@ -64,3 +64,3 @@ "type": "module", | ||
}, | ||
"gitHead": "e2a97d380fc4150781004092ea054f5d0fc7a8c0" | ||
"gitHead": "c5abbac9280c3a2f30758188233a7b27367901d1" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19544
339