Coder Social home page Coder Social logo

Comments (2)

Grokzen avatar Grokzen commented on September 22, 2024

@hjlee9182 I do not get your question really, are you asking how to access the pool and to make a proper shutdown? or are you asking that if you really need to shutdown a pool?

from redis-py-cluster.

Grokzen avatar Grokzen commented on September 22, 2024

So if the question is regarding that if you need to or not, it depends on how your FastAPI process and code works. If you are going to reuse the same pool object multiple times instead of just making a new instance of it then yes you Must disconnect or you migt even want to run pool.reset() if you are going to reuse it as that does some other cleanup resetting it back to 0 to be able to be used again at a later time. I do however recommend that you create a new pool instance if possible as that ensures that you get back to a good and empty state properly.
Also note that this does depends on if your process shutsdown or not. If your process manager just restarts your server then a new pool will be created each time and any old objects and old sockets/connections will automatically be reaped and deallocated and new ones will be created when your next process starts up. If you are within the same process then you must deallocate and reap these things yourself like you do in your example above, if that is how a shutdown event is processed within FastAPI, i dunno about that tho.

from redis-py-cluster.

Related Issues (20)

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.