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

karenc / db-migrator
97%
master: 97%

Build:
Build:
LAST BUILD BRANCH: 1.1.0
DEFAULT BRANCH: master
Repo Added 15 Feb 2016 06:38PM UTC
Files 22
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

LAST BUILD ON BRANCH close-db-connections
branch: close-db-connections
CHANGE BRANCH
x
Reset
  • close-db-connections
  • 0.1.1
  • 0.1.2
  • 0.1.3
  • 0.1.4
  • 0.2.0
  • 1.0.0
  • 1.0.1
  • 1.0.2
  • 1.1.0
  • context
  • db-config
  • deferred-migrations
  • devops-features
  • fix-list-order
  • fix-tests
  • fix-version
  • list
  • list-by-applied
  • logger
  • mark
  • mark-multiple
  • master
  • migrations-directory-and-context
  • move-logger
  • no-migrations-directory
  • no-schema-no-error
  • py3-schema-diff
  • repeat-migrations
  • super-user
  • tests
  • travis
  • update-psycopg2
  • update-readme
  • version

pending completion
193

push

travis-ci

karenc
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.

1022 of 1052 relevant lines covered (97.15%)

1.93 hits per line

Relevant lines Covered
Build:
Build:
1052 RELEVANT LINES 1022 COVERED LINES
1.93 HITS PER LINE
Source Files on close-db-connections
  • List 0
  • Changed 4
  • Source Changed 3
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line

Recent builds

Builds Branch Commit Type Ran Committer Via Coverage
193 close-db-connections 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 foun... push 26 Oct 2017 02:38PM UTC karenc travis-ci pending completion  
185 close-db-connections Update version to 1.0.2 push 20 Oct 2017 03:25PM UTC karenc travis-ci pending completion  
See All Builds (186)
  • Repo on GitHub
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

© 2025 Coveralls, Inc