Code Monkey home page Code Monkey logo

Comments (2)

cabol avatar cabol commented on July 17, 2024

Hey 👋 !! Yeah, like you said, there is no obvious way to address this. I agree that a different exception like Nebulex.RegistryLookupError may look a bit better, but the problem remains. Unregistering before shutdown I don't think is a suitable solution because, first of all, the cache supervisor can be explicitly stopped or it can just crash, and in that case, where are we going to unregister? Second of all, unregistering means deleting the context from the Registry which uses the :persistent_term, and that could be expensive, that's why it is handled by the registry itself monitoring the cache supervisor process, and when it dies, it unregistered (similar to Ecto for example). I will think about it, and see if there is something we can do about it, but I think it is important to understand your use case also, maybe I can help you more. For example, why the cache is crashing, or why you are stopping it? How your main supervision tree is configured, because, if you have other processes depending on the cache, perhaps you can use another strategy like :rest_for_one ensuring when the cache supervisor is restarted, their dependants are restarted too. anyway, it is just to throw some ideas, let me know your thoughts. Thanks!

from nebulex.

martosaur avatar martosaur commented on July 17, 2024

Registry can still listen to supervisor exit messages and unregister in case supervisor didn't do this!

I will think about it, see if there is something we can do about it, but I think it is important to understand your use case also, maybe I can help you more. For example, why the cache is crashing or why you are stopping it? How your main supervision tree is configured, because, if you have other processes depending on the cache, perhaps you can use another strategy like :rest_for_one ensuring when the cache supervisor is restarted, their dependants are restarted too. anyway, it is just to throw some ideas, let me know your thoughts

Our use case is nothing special: we have Cache process in our main Application supervisor tree and we see errors on the app shutdown, since there's still some residual traffic from client processes on other nodes (we use this adapter which broadcasts events to other nodes).

One possible way to go about this is to have special worker process among supervisor children which will unregister on exit. The same way Bootstrap process is used to leave cluster in Partitioned and Replicated adapters

from nebulex.

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.