codeant-ai-for-open-source[bot] commented on PR #38576:
URL: https://github.com/apache/superset/pull/38576#issuecomment-4055433954

   ## **Sequence Diagram**
   
   This PR prevents duplicate thumbnail generation for the same dashboard by 
marking work as computing before task enqueue and adding an early dedup check 
inside the Celery task. Together, these changes stop concurrent requests from 
launching multiple Selenium sessions.
   
   ```mermaid
   sequenceDiagram
       participant ClientA as Client
       participant ClientB as Concurrent Client
       participant API as Dashboard API
       participant Cache
       participant Queue as Celery Queue
       participant Worker as Thumbnail Worker
   
       ClientA->>API: Request dashboard thumbnail
       API->>Cache: Set status to COMPUTING
       API->>Queue: Enqueue thumbnail task
       API-->>ClientA: Return accepted response
   
       ClientB->>API: Request same thumbnail
       API->>Cache: Check current status
       API-->>ClientB: Skip new enqueue
   
       Queue->>Worker: Run thumbnail task
       Worker->>Cache: Check status for cache key
       alt Already computing and not stale
           Worker-->>Queue: Skip duplicate task
       else Not computing or stale
           Worker->>Worker: 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]

Reply via email to