bito-code-review[bot] commented on code in PR #41097:
URL: https://github.com/apache/superset/pull/41097#discussion_r3439988227


##########
superset/utils/screenshots.py:
##########
@@ -312,6 +312,8 @@ def compute_and_cache(  # pylint: disable=too-many-arguments
         if image:
             with 
event_logger.log_context(f"screenshot.cache.{self.thumbnail_type}"):
                 cache_payload.update(image)
+        else:
+            cache_payload.error()

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Duplicate error() call</b></div>
   <div id="fix">
   
   The new `else` block calls `error()` which overwrites the timestamp even 
when `error()` was already called earlier at line 302 or 308. This masks the 
actual error timing. Add a guard to check if status is already ERROR before 
calling error() again.
   </div>
   
   
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ```
    --- superset/utils/screenshots.py (lines 312-319)---
    312:         if image:
    313:             with 
event_logger.log_context(f"screenshot.cache.{self.thumbnail_type}"):
    314:                 cache_payload.update(image)
    315:         elif cache_payload.status != StatusValues.ERROR:
    316:             cache_payload.error()
    317:
    318:         logger.info("Caching thumbnail: %s", cache_key)
    319:         self.cache.set(cache_key, cache_payload.to_dict())
   ```
   
   </div>
   </details>
   
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #cf58ee</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



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