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

Make polling apiclient update check frequency configurable #456

Open
jpmcb opened this issue May 23, 2023 · 3 comments
Open

Make polling apiclient update check frequency configurable #456

jpmcb opened this issue May 23, 2023 · 3 comments

Comments

@jpmcb
Copy link
Contributor

jpmcb commented May 23, 2023

Frequency of polled updates

Currently, polling for a new update seem to be every 10 seconds:

// Retry up to 5 times in case the Update API is busy; Waiting 10 seconds between each attempt.
while attempts < MAX_ATTEMPTS {
let output = Command::new(API_CLIENT_BIN)
.args(&args)
.output()
.context(apiclient_error::ApiClientRawCommandSnafu { args: args.clone() })?;

It would be great if there was an brupop setting that made polling for updates configurable

        - name: POLLING_UPDATE_FREQUENCY
          value: 10

where the value is an expected length of seconds

Why?

Some users may not want egress traffic to the updates endpoint very frequently. Or maybe they want to poll for an update more frequently. This may be a network traffic restriction, the fact that nodes are deployed on edge (and polling for frequent updates are not ideal), etc.

@jpmcb jpmcb changed the title Make pooling apiclient update check configurable Make pooling apiclient update check frequency configurable May 23, 2023
@gthao313
Copy link
Member

gthao313 commented Jun 1, 2023

I don't think it's correct maybe I'm wrong.

Currently, pooling for a new update seem to be every 10 seconds:

The attempt logic here is to deal with 423 Locked response. The apiclient only sleep 10 sec if the update API return 423; otherwise if will return the output or error. Update API doesn't support frequent ask at short time, and it will return 423 busy if they are executing something.

UPDATE_API_BUSY_STATUSCODE => {
event!(Level::INFO, "API server busy, retrying later ...");
// Retry after ten seconds if we get a 423 Locked response (update API busy)
sleep(UPDATE_API_SLEEP_DURATION).await;
attempts += 1;

Base on that, that setting you think we should introduce might not be related to this part. If I understand correct, we probably can look at agentclient which asks to invoke apiclient update check.

@jpmcb jpmcb changed the title Make pooling apiclient update check frequency configurable Make polling apiclient update check frequency configurable Jun 2, 2023
@jpmcb
Copy link
Contributor Author

jpmcb commented Jun 2, 2023

Good call - yeah I wasn't sure if that was exactly where we have the logic for frequency of polling. But somewhere, we should have a setting that we can make it configurable for users who need much less polling than we currently provide.

@cbgbt
Copy link
Contributor

cbgbt commented Aug 16, 2023

#524 reduces the default polling interval to 2 minutes, but I agree that we should make this configurable.

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

No branches or pull requests

3 participants