RNHTTR commented on code in PR #39823:
URL: https://github.com/apache/airflow/pull/39823#discussion_r1621377914
##########
airflow/sensors/base.py:
##########
@@ -344,6 +344,37 @@ def _get_next_poke_interval(
if not self.exponential_backoff:
return self.poke_interval
+ if self.reschedule:
+ # Calculate elapsed time since the sensor started
+ elapsed_time = run_duration()
+
+ # Initialize variables for the simulation
+ cumulative_time = 0
+ estimated_poke_count = 0
+
+ while cumulative_time < elapsed_time:
+ estimated_poke_count += 1
+ # Calculate min_backoff for the current try number
+ min_backoff = max(int(self.poke_interval * (2 **
(estimated_poke_count - 1))), 1)
+
+ # Calculate the jitter
Review Comment:
```suggestion
# Calculate the jitter, which is used to prevent multiple
sensors simultaneously poking
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]