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


##########
airflow/dag_processing/manager.py:
##########
@@ -631,25 +646,60 @@ def _get_priority_filelocs(cls, session: Session = 
NEW_SESSION):
             session.delete(request)
         return filelocs
 
-    def _refresh_dag_dir(self) -> bool:
-        """Refresh file paths from dag dir if we haven't done it for too 
long."""
-        now = time.monotonic()
-        elapsed_time_since_refresh = now - self.last_dag_dir_refresh_time
-        if elapsed_time_since_refresh <= self.dag_dir_list_interval:
-            return False
+    def _refresh_dag_bundles(self):
+        """Refresh DAG bundles, if required."""
+        now = timezone.utcnow()
 
-        # Build up a list of Python files that could contain DAGs
-        self.log.info("Searching for files in %s", self._dag_directory)
-        self._file_paths = list_py_file_paths(self._dag_directory)
-        self.last_dag_dir_refresh_time = now
-        self.log.info("There are %s files in %s", len(self._file_paths), 
self._dag_directory)
-        self.set_file_paths(self._file_paths)
+        self.log.info("Refreshing DAG bundles")
+
+        for bundle in self._dag_bundles:

Review Comment:
   this section is very long (the scope of each loop) and it's hard to 
understand what it's really doing.  
   
   for sure, you can leave it if you want. it won't be the only place in the 
codebase like this.
   
   but if you want to make it more easily understandable, one way to do it 
might be to make some inner functions that do specific things, and call them. 
or there might be some other means.



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