edwardwang888 commented on a change in pull request #17003:
URL: https://github.com/apache/airflow/pull/17003#discussion_r693297243



##########
File path: airflow/models/taskinstance.py
##########
@@ -939,9 +939,9 @@ def next_retry_datetime(self):
         delay = self.task.retry_delay
         if self.task.retry_exponential_backoff:
             # If the min_backoff calculation is below 1, it will be converted 
to 0 via int. Thus,
-            # we must round up prior to converting to an int, otherwise a 
divide by zero error
-            # will occur in the modded_hash calculation.
-            min_backoff = int(math.ceil(delay.total_seconds() * (2 ** 
(self.try_number - 2))))
+            # we must impose a lower bound of 1 prior to converting to an int, 
otherwise a divide
+            # by zero error will occur in the modded_hash calculation.
+            min_backoff = int(max(1, delay.total_seconds() * (2 ** 
(self.try_number - 2))))

Review comment:
       That works. Is the reason for using `modified_delay` to prevent this 
from becoming a breaking change?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to