@nxtedition/lib 26.3.4 → 26.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/http.js +9 -1
- package/package.json +1 -1
package/http.js
CHANGED
|
@@ -199,10 +199,14 @@ export async function upgradeMiddleware(ctx, next) {
|
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
export async function requestMiddleware(ctx, next) {
|
|
202
|
-
const { req, res, target } = ctx
|
|
202
|
+
const { req, res, target, stats } = ctx
|
|
203
203
|
const startTime = performance.now()
|
|
204
204
|
|
|
205
205
|
const reqLogger = ctx.logger?.child({ req })
|
|
206
|
+
|
|
207
|
+
if (stats?.pending != null) {
|
|
208
|
+
stats.pending++
|
|
209
|
+
}
|
|
206
210
|
try {
|
|
207
211
|
const isHealthcheck = req.url === '/healthcheck' || req.url === '/_up'
|
|
208
212
|
if (!isHealthcheck) {
|
|
@@ -338,6 +342,10 @@ export async function requestMiddleware(ctx, next) {
|
|
|
338
342
|
res.destroy(err)
|
|
339
343
|
}
|
|
340
344
|
} finally {
|
|
345
|
+
if (stats?.pending != null) {
|
|
346
|
+
stats.pending--
|
|
347
|
+
}
|
|
348
|
+
|
|
341
349
|
if (res.writableEnded || res.destroyed || res.stream?.destroyed) {
|
|
342
350
|
// Do nothing..
|
|
343
351
|
} else {
|