Skip to content

Commit

Permalink
move date update timer
Browse files Browse the repository at this point in the history
  • Loading branch information
bung87 committed Jan 16, 2024
1 parent 7e48c18 commit 6f7f385
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/scorper/http/streamserver.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 =
Expand Down

0 comments on commit 6f7f385

Please sign in to comment.