-
Notifications
You must be signed in to change notification settings - Fork 105
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
Adding a context to the remote for shutdown. #76
Merged
Merged
Conversation
This file contains 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
…sed to the remote. It will shut down the remote when the context is cancelled. One minor change. The engine now has a GetLogger() which responds with the logger, so the remote can set up logging on its own.
@anthdm I think this is ready to be merged now. I'm resonably happy with it. Let me know if there anything you wanna change and I can adjust it. |
@perbu This is going to be a fun conflicting resolve session for you, huh? xD |
conflicts resolved. ready to merge. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
one major change. engine.WithRemote now takes a context, which is passed to the remote. It will shut down the remote when the context is cancelled.
one minor change. The engine now has a GetLogger() which responds with the logger, so the remote can set up logging on its own. previously you had to supply a logger directly to the remote, which is cumbersome and error prone.
I've tried and failed to avoid adding another method to the engine to do this. The alternative would be to make the remote package internal, meaning the user would not be able to import the remote package directly.
trivial changes:
Todo: Since the remote now can be shut down, how should the remote behave in it's shutdown state? Should it have a flag indicating that it is still active? Should it panic when somebody tries to use it? Please advice.
Todo: When expanding on the tests to check that we actually stop listening to the socket I didn't find a nice way to figure out if the remote has completed cancelling the remote. Any ideas here? cancel() is async so it might take a few microseconds. It seems to work on my computer, though, syscalls are slow, I guess.