codeant-ai-for-open-source[bot] commented on code in PR #44082:
URL: https://github.com/apache/superset/pull/44082#discussion_r4067867284
##########
superset/dashboards/api.py:
##########
@@ -1797,20 +1811,29 @@ def export_xlsx(self, pk: int) -> WerkzeugResponse:
except SupersetSecurityException:
return self.response_403()
- # Email delivery is the only result channel, so an account with an
email
- # address is required; embedded guest users are excluded in this
version.
+ # Both delivery paths require a non-guest account with an email
address.
if isinstance(g.user, GuestUser) or not getattr(g.user, "email", None):
return self.response_400(
message="Excel export requires an account with an email
address."
)
if not dashboard.slices:
return self.response_400(message="Dashboard has no charts to
export.")
- # Throttle: one concurrent export per user+dashboard. Acquire a shared,
- # atomic distributed lock (Redis when configured, the metadata DB
- # otherwise) so the guard works across the web server and workers and
is
- # not a no-op under the default cache. The task releases it when it
- # settles; the TTL is the backstop if that release is ever lost.
+ active_data_mask = payload.get("active_data_mask", {})
+ mode = payload.get("mode", "data")
+
+ if not queued and mode == EXPORT_MODE_IMAGES:
+ # Webdriver rendering is too slow and unbounded for a web request.
+ return self.response_400(
+ message=(
+ "Exporting images to Excel runs in the background. "
+ "Configure EXCEL_EXPORT_S3_BUCKET to use it, or export "
+ "the dashboard's data instead."
+ )
+ )
+
+ # Allow one export per user and dashboard across web and worker
processes.
+ # The TTL releases the lock if normal cleanup fails.
lock_params = export_lock_params(g.user.id, dashboard.id)
try:
AcquireDistributedLock(
Review Comment:
✅ **CodeAnt verified this suggestion was addressed in subsequent commits and
marked this thread resolved** as of `be6f085`.
The acquisition token is now captured from `acquire_lock.token` and passed
to the queued and inline export cleanup paths, ensuring releases are validated
against this acquisition.
<sub>If that's not right, unresolve this thread and CodeAnt will leave it
open.</sub>
<!-- codeant-auto-resolve-reply -->
--
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]