From 6f7f3858f642d6ee300c92cedc76b558adb2c15c Mon Sep 17 00:00:00 2001 From: bung87 Date: Tue, 16 Jan 2024 23:34:00 +0800 Subject: [PATCH] move date update timer --- src/scorper/http/streamserver.nim | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/scorper/http/streamserver.nim b/src/scorper/http/streamserver.nim index 1f46ac9..db90d57 100644 --- a/src/scorper/http/streamserver.nim +++ b/src/scorper/http/streamserver.nim @@ -841,15 +841,7 @@ template processClientImpl(isSecurity: bool): proc (server: StreamServer, transp else: req.reader = req.transp.newAsyncStreamReader req.writer = req.transp.newAsyncStreamWriter - var pipeContinuation: proc (udata: pointer) {.gcsafe, raises: [].} - const Du = chronos.microseconds(1000) - pipeContinuation= proc (udata: pointer) {.gcsafe, raises: [].} = - serverDate = httpDate() - discard setTimer(Moment.fromNow(Du), - pipeContinuation, nil) - serverDate = httpDate() - discard setTimer(Moment.fromNow(Du), - pipeContinuation, nil) + while not transp.atEof(): let retry = await processRequest(req.server, req, isSecurity) handlePostProcessMiddlewares(req) @@ -880,7 +872,15 @@ proc newScorperMimetypes(): MimeDB {.inline.} = template initScorper(server: Scorper, isSecurity: static[bool]) = server.privAccpetParser = accpetParser() server.httpParser = MofuParser() - + var pipeContinuation: proc (udata: pointer) {.gcsafe, raises: [].} + const Du = chronos.microseconds(1000) + pipeContinuation= proc (udata: pointer) {.gcsafe, raises: [].} = + serverDate = httpDate() + discard setTimer(Moment.fromNow(Du), + pipeContinuation, nil) + serverDate = httpDate() + discard setTimer(Moment.fromNow(Du), + pipeContinuation, nil) var onError = proc(error: Exception): void = debugEcho $error var onCompleted = proc(): void =