canonical/pycloudlib

Unify wait strategies

Closed this issue · 1 comments

I think we could move this function up into a more general function for pycloudlib. There's way too many places where we do a wait loop instead of using a function like this.

However, I would make sleep time configurable (with a default of 1). I think we should also either
a) Rename `timeout_seconds` to something like `attempts`
or
b) Check clock time and break once we've hit the timeout.

With this current implementation, we're waiting more than `timeout_seconds` due to the added time it takes to call `check_fn`

_Originally posted by @TheRealFalcon in https://github.com/canonical/pycloudlib/pull/225#discussion_r1065807866_

Duplicates #72