Skip to content

add equality and hashability to Retry and backoff classes #3628

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

terencehonles
Copy link
Contributor

@terencehonles terencehonles commented May 2, 2025

Description of change

This change adds equality and hashability to Retry and backoff classes.

This broke in DjangoRQ (fixed) after #3622 / #3614 and I provided a workaround in rq/django-rq#706, but this allows other downstream libraries to compare two retry instances.

Pull Request check-list

Please make sure to review and check all of these items:

  • Do tests and lints pass with this change?
  • Do the CI tests pass with this change (enable it first in your forked repo and wait for the github action build to finish)?
  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Is there an example added to the examples folder (if applicable)?
  • Was the change added to CHANGES file?

NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds equality and hashability methods to the Retry and various backoff classes to support reliable comparisons between retry instances in downstream libraries.

  • Introduces eq and hash for Retry and multiple backoff classes.
  • Augments the test suite with new test cases to validate equality/hashability behavior.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
tests/test_retry.py Adds tests validating equality and hashability of Retry instances.
redis/retry.py Implements eq and hash methods for the Retry class.
redis/backoff.py Adds equality and hashability implementations for several backoff types.

@terencehonles terencehonles force-pushed the add-equality-and-hashability-to-retry-classes branch 3 times, most recently from ebeed2a to 464721d Compare May 2, 2025 11:29
@terencehonles terencehonles force-pushed the add-equality-and-hashability-to-retry-classes branch from 464721d to 5b9fe2e Compare May 2, 2025 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant