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

Adding a context to the remote for shutdown. #76

Merged
merged 10 commits into from
Dec 4, 2023

Conversation

perbu
Copy link
Collaborator

@perbu perbu commented Dec 2, 2023

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:

  • The make files now also builds the examples using the remote.
  • the log package contains a Debug() which returns a logger with debug level preset. Useful when developing tests.
  • I've also tried to document some functions which had missing or imcomplete docs.

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.

perbu added 2 commits December 2, 2023 08:42
…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.
@perbu
Copy link
Collaborator Author

perbu commented Dec 2, 2023

@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.

@anthdm
Copy link
Owner

anthdm commented Dec 3, 2023

@perbu This is going to be a fun conflicting resolve session for you, huh? xD

@perbu
Copy link
Collaborator Author

perbu commented Dec 3, 2023

conflicts resolved. ready to merge.

@anthdm anthdm merged commit 1142617 into anthdm:master Dec 4, 2023
1 check passed
@perbu perbu deleted the remote-shutdown branch December 6, 2023 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants