bito-code-review[bot] commented on PR #43340:
URL: https://github.com/apache/superset/pull/43340#issuecomment-5346913092

   <!-- Bito Reply -->
   The flagged issue is correct. In `superset/tasks/export_dashboard_excel.py`, 
the guest user reconstruction 
(`security_manager.get_guest_user_from_token(guest_token)`) occurs before the 
`try`/`finally` block that ensures the distributed lock is released. If this 
reconstruction fails, the task terminates without releasing the lock, causing 
subsequent exports for that dashboard to be blocked until the TTL expires.
   
   To resolve this, move the user reconstruction logic inside the `try` block 
or ensure the lock is released in a `finally` block that covers the entire 
execution path. Given the current structure, wrapping the user initialization 
in the `try` block is the most straightforward fix.
   
   **superset/tasks/export_dashboard_excel.py**
   ```
   # ... (previous code)
       requested_at = datetime.now(tz=timezone.utc)
       try:
           if user_id is not None:
               user = security_manager.get_user_by_id(user_id)
           elif guest_token:
               user = security_manager.get_guest_user_from_token(guest_token)
           else:
               user = None
           # ... (rest of the logic)
       finally:
           # ... (lock release logic)
   ```


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