Skip to content
This repository was archived by the owner on Aug 2, 2021. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ class MongoDbPool extends ConnectionPool<Db> {
/**
* Retrieve and release a connection from the pool.
*/
app.Interceptor(r'/.*')
dbInterceptor(MongoDbPool pool) {
@app.Interceptor(r'/.*')
dbInterceptor(@app.Inject() MongoDbPool pool) {

//get a connection
pool.getConnection().then((managedConnection) {
return pool.getConnection().then((managedConnection) {

//save the connection in the attributes map
app.request.attributes["conn"] = managedConnection.conn;

app.chain.next(() {
return app.chain.next(() {
if (app.chain.error is ConnectionException) {
//if a connection is lost, mark it as invalid, so the pool can reopen it
//in the next request
Expand Down