Comments (3)
It appears that psycopg2.OperationalError
(the exception raised when the database cannot be connected to) is not caught by the try...except
block inside django.core.handlers.base.BaseHandler.get_response
, so I'm not able to use django.core.signals.got_request_exception
to take that database out of the pool. I'm trying to find another way, but it looks like I may be going down the wrong path. I'm open to suggestions on other ways to handle this.
from django-balancer.
I could probably create a new database backend that subclasses DatabaseWrapper and wraps ._cursor() in a try...except
block. I'd have to make a new backend for every existing backend, though, and that would be messy. I want something more elegant. Back to the drawing board...
from django-balancer.
Wrapping the cursor (or even ... you could monkeypatch it) is probably the easiest way.
I have looked at this issue a couple of months ago when writing django-statsd (http://pypi.python.org/pypi/django-statsd/) and it seemed that monkeypatching is the best way to go here.
But if you know any good way to do it, please let me know.
from django-balancer.
Related Issues (11)
- 'WSGIRequest' object has no attribute 'session' HOT 5
- Slave connection not present
- Django 1.8 Support HOT 1
- Add Travis & Coveralls Support
- Can't do subqueries with queries on different DBs. HOT 4
- DatabaseError: canceling statement due to conflict with recovery HOT 1
- InterfaceError: connection already closed HOT 1
- RoundRobinRouter shuffles self.pool, which is a setting. HOT 2
- Querysets joins HOT 5
- Update pypi
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-balancer.