Repository navigation
docs: log the first retry at INFO in the callback example - #765
Open
tongwentao wants to merge 1 commit into
Open
tongwentao wants to merge 1 commit into
tongwentao wants to merge 1 commit into
Conversation
Contributor
|
Tick the box to add this pull request to the merge queue (same as
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The custom
before_sleeplogging example checksattempt_number < 1, but attempts are numbered from 1. Its INFO branch is therefore unreachable, and every retry logs at WARNING.Check
attempt_number == 1so the first retry logs at INFO and subsequent retries log at WARNING. The README links to the same documentation source, so both views receive the correction. Library behavior is unchanged. Include a Reno note.Behavior and review notes
This callback runs before sleeping for a retry, so the example's first callback already has
attempt_number == 1. The correction changes the example's choice of log level, not Tenacity's retry count, wait policy, or callback scheduling. Running the exact documentation block checks the advertised INFO-then-WARNING sequence rather than a separately maintained approximation.Validation on Linux, Python 3.13.5:
Logger.log: before the correction both events were WARNING; afterward they are INFO then WARNING.poe check: 185 tests and 35 documentation tests passed; strict Sphinx HTML build passed.poe lintandpoe mypy: passed.git diff --check: passed.Prepared and validated with Codex assistance.