I just noticed in the [Introducing ORC blog 
post](https://nim-lang.org/blog/2020/12/08/introducing-orc.html) that while 
example has sessions, it it doesn't use it. How these sessions are meant to be 
used in the response? The code from example copied below
    
    
    import asynchttpserver, asyncdispatch, strutils, json, tables, streams
    
    # about 135 MB of live data:
    var sessions: Table[string, JsonNode]
    for i in 0 ..< 10:
      sessions[$i] = parseJson(newFileStream("1.json", fmRead), "1.json")
    
    var served = 0
    
    var server = newAsyncHttpServer()
    proc cb(req: Request) {.async.} =
      inc served
      await req.respond(Http200, "Hello World")
      if served mod 10 == 0:
        when not defined(memForSpeed):
          GC_fullCollect()
    
    waitFor server.serve(Port(8080), cb)
    
    
    Run

Reply via email to