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

WIP: agent: use context for cancellation in agent.Start() #7609

Closed
wants to merge 4 commits into from

Conversation

dnephin
Copy link
Contributor

@dnephin dnephin commented Apr 7, 2020

I made these changes last week while digging into the agent command. They are not quite ready for review, but opening this PR in case anyone is interested.

Using context for cancellation has a number of advantages. Primarily:

  • removes a field from the struct, a small step in shrinking Agent
  • multiple go routines can call <-Done and get their own channel, all of which will be closed by a single cancel.

dnephin added 4 commits April 3, 2020 17:13
Very minor change, but this check will be slightly more reliable and likely faster.
Replace a field on Agent with context.Context
When the context is cancelled Start will exit. Termination signals cancel the context.
The cancellation is deferred to shutdown the goroutine listen to the signal chan.
@dnephin
Copy link
Contributor Author

dnephin commented Jun 19, 2020

The important changes from this PR were made in #8157, so closing.

@dnephin dnephin closed this Jun 19, 2020
@dnephin dnephin deleted the dnephin/agent-startup branch June 19, 2020 18:30
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.

1 participant