rusackas commented on code in PR #41250:
URL: https://github.com/apache/superset/pull/41250#discussion_r3461674230
##########
superset/utils/core.py:
##########
@@ -948,9 +953,11 @@ def send_mime_email(
# root CA certificates
ssl_context = ssl.create_default_context() if smtp_ssl_server_auth else
None
smtp = (
- smtplib.SMTP_SSL(smtp_host, smtp_port, context=ssl_context)
+ smtplib.SMTP_SSL(
+ smtp_host, smtp_port, context=ssl_context, timeout=smtp_timeout
+ )
if smtp_ssl
- else smtplib.SMTP(smtp_host, smtp_port)
+ else smtplib.SMTP(smtp_host, smtp_port, timeout=smtp_timeout)
)
Review Comment:
Good catch — wrapped the session in try/finally so quit() always runs
(swallowing SMTPException on the way out) even when the new timeout fires
mid-send.
##########
superset/utils/webdriver.py:
##########
@@ -462,6 +462,11 @@ def driver(self) -> WebDriver:
if not self._driver:
raise RuntimeError("WebDriver creation failed")
self._driver.set_window_size(*self._window)
+ # Bound driver.get() so an unreachable page raises a
TimeoutException
+ # instead of blocking the worker (and the report schedule) forever.
+ page_load_wait = app.config["SCREENSHOT_PAGE_LOAD_WAIT"]
+ if page_load_wait is not None:
+ self._driver.set_page_load_timeout(page_load_wait)
Review Comment:
Good point — now tearing the driver down via _destroy() and re-raising if
window-size/page-load-timeout/auth setup throws, so a half-initialized driver
isn't left cached.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]