-
Couldn't load subscription status.
- Fork 6
Add Dispatcher.refresh() method #81
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is a good idea Design-wise. The idea is to only communicate with actors via channels once they are created. Maybe for this case is overkill, at least until we can really distribute actors in other processes/nodes, and if that is the case ok, but I would leave it as a private method and just add an ignore and a comment saying this is a hack.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right thanks! My use case:
I have an actor that uses Dispacher.
When Dispacher starts (For the first time) it sends all dispaches and I receive them.
If my actor crashes and restarts latest dispaches are not send. And this is understandable because dispacher doesn't know that I restarted.
Another solution would be to create new dispacher on every restart. Would it be ok?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to clarify, as you commented in this review comment, I'm only referring to the call to the actor inside
refresh(), addingrefresh()itself is OK becauseDispatcheris just a class that uses an actor underneath (and the class instance should always be local, only the actor might be in another process/node).That said, yeah, I think if it crashes it should be OK to re-create, it shouldn't happen all the time anyway.
But I don't oppose to this addition, I think things could go wrong and having a way to force a refresh could still be useful in some cases. But maybe we should add some sort of
Warningifrefresh()is not really intended to be used in normal conditions, just to avoid confusion or people thinking they need to actively refresh the dispatcher instance.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, the dispatcher should be instantiated by the app, not an actor, right? We should have only one dispatcher for the whole app/all actors, no?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point, yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I will think and redesign my use case... Sorry