-
Notifications
You must be signed in to change notification settings - Fork 11
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
agent/agent: Refactor run command #76
Conversation
6fe0b98
to
cbd0872
Compare
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, but the agent is not properly updating the source with credentials URL for some reason, but I really can't find why.
8bbfb31
to
2ff77cf
Compare
internal/agent/config.go
Outdated
@@ -27,7 +27,7 @@ const ( | |||
// DefaultPlannerEndpoint is the default address of the migration planner server | |||
DefaultPlannerEndpoint = "https://localhost:7443" | |||
// DefaultHealthCheck is the default value for health check interval in seconds. | |||
DefaultHealthCheck = 5 * 60 // 5 min | |||
DefaultHealthCheck = 10 // 5 min |
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.
Please fix the comment, also maybe explain in comment why it's 10seconds now.
case <-updateTicker.C: | ||
} | ||
|
||
// check for health. Send requests only if we have connectivity |
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.
Can you please explain why the code below is not part of case <-updateTicker.C:
?
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.
It is but I've put it out of the scope for better readability. the select
will block until tick or cancel().
The run command has been refractor to make it simpler. The inventory status method does not have a loop anymore and it is called from the agent itself. The health check state is checked before sending update requests. The idea is to reorganize the "inventory" and "healthcheck" into a stateless services and let the agent control everything. This commit does not change the logic of the agent in any way, it just tries to improve organization of the code and the readability. Signed-off-by: Cosmin Tupangiu <[email protected]>
2ff77cf
to
40b330b
Compare
The run command has been refractor to make it simpler. The inventory status method does not have a loop anymore and it is called from the agent itself.
The health check state is checked before sending update requests.
The idea is to reorganize the "inventory" and "healthcheck" into a stateless services and let the agent control everything.
This commit does not change the logic of the agent in any way, it just tries to improve organization of the code and the readability.
Signed-of-by: Cosmin Tupangiu [email protected]