dstandish commented on code in PR #46870:
URL: https://github.com/apache/airflow/pull/46870#discussion_r1962375563


##########
airflow/dag_processing/manager.py:
##########
@@ -447,6 +453,17 @@ def _refresh_dag_bundles(self, known_files: dict[str, 
set[DagFileInfo]]):
         """Refresh DAG bundles, if required."""
         now = timezone.utcnow()
 
+        # we don't need to check if it's time to refresh every loop - that is 
way too often
+        last_checked_ago = time.monotonic() - self._bundles_last_refreshed
+        if last_checked_ago < self.bundle_refresh_check_interval:
+            self.log.debug(
+                "Not time to check if DAG Bundles need refreshed yet - 
skipping. Next check in %.2f seconds",
+                self.bundle_refresh_check_interval - last_checked_ago,
+            )
+            return
+
+        self._bundles_last_refreshed = time.monotonic()

Review Comment:
   maybe simpler?  take or leave
   
   ```suggestion
           # we don't need to check if it's time to refresh every loop - that 
is way too often
           next_check = self._bundles_last_refreshed + 
self.bundle_refresh_check_interval
           now_ss = time.monotonic()
           if now_ss < next_check:
               self.log.debug(
                   "Not time to check if DAG Bundles need refreshed yet - 
skipping. "
                   "Next check in %.2f seconds",
                   next_check - now_ss,
               )
               return
   
           self._bundles_last_refreshed = now_ss
   ```



-- 
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]

Reply via email to