codeant-ai-for-open-source[bot] commented on PR #38576:
URL: https://github.com/apache/superset/pull/38576#issuecomment-4049733247
## **Sequence Diagram**
This PR prevents duplicate dashboard thumbnail generation by introducing
deduplication in two places: at request time and at task execution time. The
API now marks work as computing before enqueueing, and the Celery task skips
expensive screenshot work when a fresh computing task already exists.
```mermaid
sequenceDiagram
participant ClientA as Client A
participant ClientB as Client B
participant API as Dashboard API
participant Cache
participant Task as Celery Thumbnail Task
participant Renderer as Screenshot Renderer
ClientA->>API: Request dashboard thumbnail
API->>Cache: Set status COMPUTING
API->>Task: Enqueue thumbnail task
ClientB->>API: Request same thumbnail
API->>Cache: Check current status
API-->>ClientB: Return in progress response without enqueue
Task->>Cache: Check status for cache key
alt Fresh COMPUTING exists
Task-->>Task: Skip duplicate execution
else Not computing or stale
Task->>Renderer: Compute and cache thumbnail
end
```
---
*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]