Increase default SnapClient timeout to 30 seconds #111
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Increase default SnapClient timeout to 30 seconds
Description
SnapClient has a default timeout of 5 seconds for all RPCs to
the snapd socket. If any operation takes more, an exception is
raised to the caller.
We have seen this causing issues in slow CI environments, where
a simple config-changed hook will attempt to check if a snap is
installed, timeout and move the unit to a blocked status (causing
the CI run to fail). This is augmented by the fact that typically
SnapCache is used instead of SnapClient, which only uses the default
value and does not provide a way to configure the timeout.
Simply increasing the timeout is enough to tackle the flakes.
Notes
A possible alternative could be to surface the timeout option to SnapCache,
but that then would require each consumer of the library to set the timeout.