Nataneljpwd commented on code in PR #52700:
URL: https://github.com/apache/airflow/pull/52700#discussion_r2270873841


##########
providers/sftp/src/airflow/providers/sftp/sensors/sftp.py:
##########
@@ -135,6 +137,20 @@ def poke(self, context: Context) -> PokeReturnValue | bool:
         else:
             files_found = actual_files_present
 
+        return files_found
+
+    def poke(self, context: Context) -> PokeReturnValue | bool:
+        self.hook = SFTPHook(self.sftp_conn_id, managed_conn=self.managed_conn)
+
+        self.log.info("Poking for %s, with pattern %s", self.path, 
self.file_pattern)
+        files_found = []
+
+        if not self.managed_conn:
+            with self.hook.get_managed_conn():
+                files_found = self._get_files()

Review Comment:
   not really, because here we check if the connection is not managed, and if 
so, create a connection, the decorator does not create a connection in case the 
connection is managed, as it relies on the user to do so, just like I did here



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