GithubHelp home page GithubHelp logo

Comments (3)

bkonkle avatar bkonkle commented on June 12, 2024

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.

bkonkle avatar bkonkle commented on June 12, 2024

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.

wolph avatar wolph commented on June 12, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.