eschutho commented on a change in pull request #13346:
URL: https://github.com/apache/superset/pull/13346#discussion_r583292557



##########
File path: superset/databases/commands/create.py
##########
@@ -54,10 +50,9 @@ def run(self) -> Model:
             try:
                 TestConnectionDatabaseCommand(self._actor, 
self._properties).run()
             except Exception:
-                db.session.rollback()
-                stats_logger.incr(
-                    f"db_connection_failed.{database.db_engine_spec.__name__}"
-                )
+                with 
event_logger.log_context(action=f"db_connection_failed.{database.db_engine_spec.__name__}"):
+                    db.session.rollback()

Review comment:
       @betodealmeida  and I were talking about this earlier, and most 
statements before the yield are pretty safe, but to be sure, I moved what I 
could below the yield statement. I don't think there's much risk of this 
failing now:
   ```
    start_time = time.time()
    payload_override = {}
    ```
    




----------------------------------------------------------------
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to