rkusa / co-rethinkdb

Generator/Promise based querying goodness for RethinkDB
MIT License
11 stars 0 forks source link

With Koa, I'm not using domain, is there a problem? #2

Closed thelinuxlich closed 10 years ago

rkusa commented 10 years ago

No. The middleware shown in the Readme is optional to achieve a per-request connection. If you don't want to use domain, use co-rethinkdb as shown in the first two examples.

As a side note, domain is a built-in module.

thelinuxlich commented 10 years ago

But a per-request connection is better than closing the connection on process exit event?

rkusa commented 10 years ago

Closing the connection on process exit sound like having only one rethinkdb connection for all incoming requests. Which is not so good.

You could create a connection per rethinkdb query. But this is also not that good.

The best solution is to have a connection pool (with e.g. node-pool or jacuzzi). The second best is to have a connection per request.