-
-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Would you mind making the bson module thread safe? Or if you'll give me some direction, I can work on it and submit a PR.
test code
import threadpool
import jester
import json
import mongopool
import bson
connectMongoPool("mongodb://User:Pass@localhost:27017/DB?authSource=admin")
var
db {.threadvar.}: MongoConnection
proc getDB(): MongoConnection =
db = getNextConnection()
return db
settings:
port = Port(8000)
staticDir = "static"
routes:
get "/getCollection":
var
db = getDB()
docs = db.find("collection", @@{"active": true}).returnMany()
sRes: seq[JsonNode]
for doc in docs:
sRes.add(parseJson(doc.pretty))
releaseConnection(db)
resp %*sRes
releaseConnection(db)The error
#[
/home/j/.nimble/pkgs/jester-0.4.3/jester.nim(1277, 9) Hint: Asynchronous route: match. [User]
/home/j/nm.nim(26, 1) template/generic instantiation of `routes` from here
/home/j/.nimble/pkgs/jester-0.4.3/jester.nim(1283, 35) template/generic instantiation of `async` from here
/home/j/.nimble/pkgs/bson-1.1.2/bson.nim(904, 6) Warning: 'pretty' is not GC-safe as it calls 'genExtendedJson' [GcUnsafe2]
/home/j/nm.nim(26, 1) template/generic instantiation of `routes` from here
/home/j/.nimble/pkgs/jester-0.4.3/jester.nim(1283, 35) template/generic instantiation of `async` from here
/home/j/.choosenim/toolchains/nim-1.2.6/lib/pure/asyncmacro.nim(278, 31) Error: 'matchIter' is not GC-safe as it calls 'pretty'
]#Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels