Closed nelsonic closed 8 years ago
100.00%
Merging #11 into master will not affect coverage as of
f00e294
@@ master #11 diff @@
======================================
Files 1 1
Stmts 23 24 +1
Branches 0 0
Methods 0 0
======================================
+ Hit 23 24 +1
Partial 0 0
Missed 0 0
Review entire Coverage Diff as of
f00e294
Powered by Codecov. Updated on successful CI builds.
@rjmk @Conorc1000 @roryc89 @naazy instead of opening a connection for each endpoint/route onPreAuth
and then closing it onPostHandler
I've decided to open a single connection pool before registering the plugin.
Then all urls have access to the same (single) connection pool and we don't ever have to close the connection.
(this was the _original objective_ of this plugin... but for some reason I was unable to get it working last week...)
Tested it for routes that don't make any postgres queries and wrote a "perf" test see: https://travis-ci.org/dwyl/hapi-postgres-connection/builds/117279687#L1321
Please feel free to comment/improve on this.
Looking forward to seeing this being exercised fully in one of our projects @Conorc1000 @naazy :+1:
Instead of connecting to PostgreSQL inside the plugin, we connect before registering the plugin. That way, we re-use the same connection (pool) for all routes and never close it until we
server.stop
...fixes https://github.com/dwyl/hapi-postgres-connection/issues/10