Skip to content

Conversation

@maccinza
Copy link
Contributor

@maccinza maccinza commented Jun 5, 2025

The _on_retry method from DelayedDelivery is still not compatible with the requirements to be used as the errback on retry_over_time since it returns None . Reference here

If we check kombu code, it's expected for the errback callable to return a float or an object that can be cast into a float. Reference here.

This causes the setup of delayed delivery to completely fail if it encounters an issue on its first try, because it will not be able to retry due to a TypeError when trying to cast a NoneType into a float.

This PR aims to fix the return type of the _on_retry method to make it compatible with the expected return type for errback.

✅ PR Checklist

  • I have added unit tests to cover the change.
  • I have verified that test coverage does not decrease.
  • I have run pre-commit or tox -e lint to ensure style and lint checks pass.

@codecov
Copy link

codecov bot commented Jun 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.51%. Comparing base (088c39c) to head (23338ec).
⚠️ Report is 44 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9741   +/-   ##
=======================================
  Coverage   78.51%   78.51%           
=======================================
  Files         153      153           
  Lines       19127    19129    +2     
  Branches     2533     2533           
=======================================
+ Hits        15018    15020    +2     
+ Misses       3821     3819    -2     
- Partials      288      290    +2     
Flag Coverage Δ
unittests 78.49% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@maccinza
Copy link
Contributor Author

maccinza commented Jun 5, 2025

@Nusnus Another issue related to _on_retry method being used as the errback on retry_over_time.

@auvipy auvipy requested review from auvipy and Copilot June 5, 2025 05:48
Copy link
Contributor

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 fixes the _on_retry method in DelayedDelivery to return a float value as required by the retry_over_time errback, preventing a TypeError when trying to cast a NoneType to a float.

  • Updated _on_retry method in delayed_delivery.py to return an interval as a float
  • Added a unit test to confirm that _on_retry now returns a float
  • Updated CONTRIBUTORS.txt with a new contributor

Reviewed Changes

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

File Description
t/unit/worker/test_native_delayed_delivery.py Added a unit test to verify _on_retry returns a float
celery/worker/consumer/delayed_delivery.py Modified _on_retry to return a float instead of None
CONTRIBUTORS.txt Added Lucas Infante as a contributor

Copy link
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

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

the change seems to be a good one. can you please check the smoke tests failures?

@maccinza maccinza requested a review from auvipy June 5, 2025 12:58
@maccinza
Copy link
Contributor Author

maccinza commented Jun 5, 2025

the change seems to be a good one. can you please check the smoke tests failures?

@auvipy, I increased the test timeout and it looks like it worked.

Copy link
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

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

yes you are right.

@maccinza
Copy link
Contributor Author

maccinza commented Jun 6, 2025

@auvipy Hey! I don't totally understand what is going on with the smoke tests timing out, so I decided to completely remove my changes (you can check it here e8eaef4) and give smoke tests a run to double check it. It looks like the timeouts are intermittent and unrelated to my changes, so I'm not sure how to properly deal with them. Any tips? Maybe @Nusnus has some hints?

I'll put my changes back but the smoke tests are still likely to fail.

@auvipy auvipy requested a review from Nusnus June 6, 2025 16:52
@auvipy
Copy link
Member

auvipy commented Jun 6, 2025

the smoke test time outs are regular occurance. dont worry about it

@auvipy auvipy merged commit 7054a0e into celery:main Jun 10, 2025
122 of 124 checks passed
@auvipy auvipy added this to the 5.5.4 milestone Jun 14, 2025
@auvipy auvipy modified the milestones: 5.5.4, 5.6.0 Jul 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants