• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

karenc / db-migrator / 195
97%

Build:
DEFAULT BRANCH: master
Ran 26 Oct 2017 04:22PM UTC
Jobs 2
Files 22
Run time 33s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
195

push

travis-ci

pumazi
Explicitly close all postgres db connections

The psycopg2 db connection `with` statement does not actually close the
database connection causing lots of idle postgres connections on the
production servers.  An idle postgres connection can be found by doing
`ps aux` on the database servers, for example you will see something
like this:

```
postgres 25498  0.0  0.5 302652 10996 ?        Ss   09:31   0:00 postgres: cnxarchive cnxarchive 192.168.122.250(42646) idle
```

On http://initd.org/psycopg/docs/usage.html#with-statement

"Note that, unlike file objects or other resources, exiting the
connection’s with block doesn't close the connection but only the
transaction associated with it"

This change creates a `db_connect` function that is like
`psycopg2.connect` but closes the db connection when exiting the `with`
block.

33 of 33 new or added lines in 3 files covered. (100.0%)

1022 of 1052 relevant lines covered (97.15%)

1.93 hits per line

Jobs
ID Job ID Ran Files Coverage
1 195.1 26 Oct 2017 04:22PM UTC 0
96.96
Travis Job 195.1
2 195.2 26 Oct 2017 04:22PM UTC 0
96.2
Travis Job 195.2
Source Files on build 195
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #195
  • 63e6329e on github
  • Prev Build on master (#183)
  • Next Build on master (#201)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc