Skip to content

Discussion: Retry hook for logging or other #11

@bodenr

Description

@bodenr

One of the PRs I had on retrying [1] was to support a generic wait hook, suitable for logging or other per-retry operations.

I was looking at tenacity and wanted to confirm how I'd do this:

def logged_wait(*args, **kwargs):
    # no-op wait just to log on each attempt
    print("Yet another logged attempt")
    return 0


@retry(wait=wait_combine(logged_wait, wait_fixed(1000)), ...)
def my_retried_func():
    # interesting retryable stuff here

Is this about right?

[1] rholder/retrying#50

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions