sadpandajoe commented on code in PR #43340:
URL: https://github.com/apache/superset/pull/43340#discussion_r3867493890


##########
superset/dashboards/excel_export/download_link.py:
##########
@@ -98,23 +99,38 @@ def build_download_url(job_id: UUID) -> str:
 
 
 def create_download_link(
-    job_id: UUID, bucket: str, key: str, expires_at: datetime
+    job_id: UUID, bucket: str, key: str, expires_at: datetime, backend: str
 ) -> str:
     """Record that ``job_id``'s export succeeded and is downloadable from
     ``key`` in ``bucket`` until ``expires_at``, and return the download URL
     (used in the success email).
 
+    ``backend`` is the dotted path of the ``ExportStorage`` class that
+    uploaded the file; the download redirect refuses to sign with a different
+    backend (see ``download_xlsx``), failing clearly after a storage migration
+    instead of minting a URL for the wrong provider.
+
     ``expires_at`` should be a naive datetime in the same timezone convention
     ``KeyValueEntry.is_expired()`` compares against (naive ``datetime.now()``).
     """
     _sweep_and_upsert(
         job_id,
-        {"status": STATUS_READY, "bucket": bucket, "key": key},
+        {"status": STATUS_READY, "bucket": bucket, "key": key, "backend": 
backend},
         expires_at,
     )
     return build_download_url(job_id)
 
 
+def mark_export_running(job_id: UUID, expires_at: datetime) -> None:
+    """Record that a worker has started executing ``job_id`` (as opposed to
+    still sitting in the queue), so a polling client can wait out broker
+    backlog without racing the task's execution budget, which only starts
+    here. Overwritten by the terminal record; ``expires_at`` is the backstop
+    if the worker dies first.
+    """
+    _sweep_and_upsert(job_id, {"status": STATUS_RUNNING}, expires_at)

Review Comment:
   The new running status is only added or mutated in the worker's SQLAlchemy 
session; neither path commits it, so concurrent status requests will not 
reliably see it. Could this commit the status update before workbook work 
begins, so queued no-email exports can actually reset their polling deadline 
when a worker starts?



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

Reply via email to