You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/03/28 15:23:38 UTC

[GitHub] [airflow] zhongjiajie commented on a change in pull request #7953: close sftp connection without error

zhongjiajie commented on a change in pull request #7953: close sftp connection without error
URL: https://github.com/apache/airflow/pull/7953#discussion_r399674024
 
 

 ##########
 File path: airflow/providers/sftp/hooks/sftp.py
 ##########
 @@ -120,12 +120,11 @@ def get_conn(self) -> pysftp.Connection:
 
     def close_conn(self) -> None:
         """
-        Closes the connection. An error will occur if the
-        connection wasnt ever opened.
+        Closes the connection
         """
-        conn = self.conn
-        conn.close()  # type: ignore
-        self.conn = None
+        if self.conn is not None:
 
 Review comment:
   ```suggestion
           if not self.conn:
   ```
   Maybe better

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services