Closed thelinuxlich closed 10 years ago
But a per-request connection is better than closing the connection on process exit event?
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.
No. The middleware shown in the Readme is optional to achieve a per-request connection. If you don't want to use
domain
, useco-rethinkdb
as shown in the first two examples.As a side note,
domain
is a built-in module.