-
Notifications
You must be signed in to change notification settings - Fork 889
feat(agent/agentcontainers): update containers periodically #17972
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
Conversation
84e7fb1
to
25ead7b
Compare
This change introduces a significant refactor to the agentcontainers API and enabled periodic updates of Docker containers rather than on-demand. Consequently this change also allows us to move away from using a locking channel and replace it with a mutex, which simplifies usage. Additionally a previous oversight was fixed, and testing added, to clear devcontainer running/dirty status when the container has been removed. Updates #16424 Updates coder/internal#621
agent/agentcontainers/api.go
Outdated
defer func() { sema <- struct{}{} }() | ||
|
||
return api.updateContainers(api.ctx) |
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.
Would it make sense instead to just return early from doUpdate()
if we're not able to read from sema
? Queueing multiple updates seems like it could cause increased memory usage over time, and I'm not sure what value we get from running it right again after one instance has just completed.
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.
If we did that, we can't wait for it to complete in the refreshContainers
function. I'll see if there's any point in keeping a refresh method around after I refactor the recreate endpoint.
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.
looks good to me 😄
This change introduces a significant refactor to the agentcontainers API
and enables periodic updates of Docker containers rather than on-demand.
Consequently this change also allows us to move away from using a
locking channel and replace it with a mutex, which simplifies usage.
Additionally a previous oversight was fixed, and testing added, to clear
devcontainer running/dirty status when the container has been removed.
Updates #16424
Updates coder/internal#621