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

Allow timeout configuration in send_command #9

Closed
Yamakaky opened this issue Sep 28, 2022 · 4 comments
Closed

Allow timeout configuration in send_command #9

Yamakaky opened this issue Sep 28, 2022 · 4 comments

Comments

@Yamakaky
Copy link

Most commands are short, so I configured a 20s timeout. However, the configuration restore for example can take longer than that. My fix is to temporarily increase the timeout:

old_timeout = client.conn_options["timeout"]
client.conn_options["timeout"] = 60
try:
    resp = client.send_command(f"CONFIG RESTORE refresh=1 list=all < {source_path}")
finally:
    client.conn_options["timeout"] = old_timeout

It would be cleaner to be able to pass a timeout (and maybe other parameters?) to send_command.

@remip2 remip2 closed this as completed in d305242 Sep 30, 2022
@remip2
Copy link
Collaborator

remip2 commented Sep 30, 2022

You can know use:

client.send_command("CONFIG BACKUP list=all > /tmp/backup.na", timeout=None)

Regards,

@Yamakaky
Copy link
Author

Nice! Any timeline for the next release?

@remip2
Copy link
Collaborator

remip2 commented Sep 30, 2022

It has just been published on pypi

@Yamakaky
Copy link
Author

Oh OK, I missed that, I'll try it!

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

2 participants