polyswarmclient.backoff_wrapper

Module Contents

polyswarmclient.backoff_wrapper.logger[source]
class polyswarmclient.backoff_wrapper.BackoffWrapper(func, **kwargs)[source]

Uses a generator to create backoff times

This is for use in functions that don’t return. In our use case, listen_for_events is not supposed to return, but exists as a long running Task. Using the decorator, the backoff time grows forever, because the function is only called one time. So each error causes a longer and longer timeout.

This adds an ability to reset the backoff, so your long running function can reduce the timeout after success

reset(self)[source]