Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a pub/sub notification mechanism and make all classes listen #81

Open
taoeffect opened this issue Dec 12, 2014 · 0 comments
Open

Add a pub/sub notification mechanism and make all classes listen #81

taoeffect opened this issue Dec 12, 2014 · 0 comments
Assignees

Comments

@taoeffect
Copy link
Member

taoeffect commented Dec 12, 2014

So right now things aren't as great as they could be in DNSChain-code land, but we've got radical improvements lined up (#80, #75).

Because we're not using a events/notifcations (the pub/sub model), we've got code like this:

shutdown: -> [@nmc, @dns, @http].forEach (s) -> s?.shutdown?()

But that's kinda lame because it "central management" and requires DNSChain to be updated for every single new server that's added. Instead, as per #80, we can implement in blockchain.coffee (the template for all supported blockchains) a notification listener for ShutdownNotification, and have the individual servers clean up for themselves.

Then DNSChain's shutdown: method would simply post that notification, wait a bit (asynchronously) and then process.exit.

NodeJS already has an event system that we can use to implement this.

Edit: Note, this part from app.coffee might need a small update.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/6958929-add-a-pub-sub-notification-mechanism-and-make-all-classes-listen?utm_campaign=plugin&utm_content=tracker%2F528702&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F528702&utm_medium=issues&utm_source=github).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants