codeant-ai-for-open-source[bot] commented on PR #38576:
URL: https://github.com/apache/superset/pull/38576#issuecomment-4054185389
## **Sequence Diagram**
This PR prevents duplicate dashboard thumbnail work at two points: before
task enqueue in the API and again at task start in the worker. Together, these
checks ensure only one fresh computation runs per dashboard thumbnail cache key.
```mermaid
sequenceDiagram
participant Client
participant DashboardAPI
participant Cache
participant CeleryWorker
participant ScreenshotService
Client->>DashboardAPI: Request dashboard thumbnail
DashboardAPI->>Cache: Read thumbnail status
alt Status not computing
DashboardAPI->>Cache: Set status to COMPUTING
DashboardAPI->>CeleryWorker: Enqueue thumbnail task
else Status already computing
DashboardAPI-->>Client: Return in progress status
end
CeleryWorker->>Cache: Check status for cache key
alt Computing and not stale
CeleryWorker-->>CeleryWorker: Skip duplicate task
else Not computing or stale
CeleryWorker->>ScreenshotService: Compute and cache thumbnail
end
DashboardAPI-->>Client: Return accepted response
```
---
*Generated by [CodeAnt AI](https://codeant.ai)*
--
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]