Open llucax opened 1 month ago
https://github.com/frequenz-floss/frequenz-sdk-python/pull/1081#discussion_r1790420629
ExponentialBackoff is hard to do with generic functions, because it needs to know if a previous attempt succeeded, so that it can reset its backoff interval.
This is easy to do with streams, we just reset it after every incoming message. But for functions, we'd need something like a timer to reset the backoff interval, if the function hasn't failed for a certain interval, then we say it succeeded, for example.
https://github.com/frequenz-floss/frequenz-sdk-python/pull/1081#discussion_r1791367022
Yeah, maybe we can have a strategy that actually takes into account for how long the task ran, so if last time it ran for a long time it waits very little to restart and if it failed immediately it waits quite a long time to restart 🤔
In the future, when we move
run_forever()
it might be nice to be able to pass a retry strategy to it. A good reason to move theretry
module fromclient-base
to this repo._Originally posted by @llucax in https://github.com/frequenz-floss/frequenz-sdk-python/pull/1081#discussion_r1790352715_