fix(ufc): throttle has_live_content(), which logged once per display frame - #474
Merged
Conversation
…frame has_live_content() runs on the display path -- once per *frame* in Vegas mode. UFC guarded only the False branch: `should_log and not ufc_live` sat at the bottom of the function, but a second INFO line lived inside the `if live_games:` block above it with no guard at all. Whenever a card was live that call fired on every frame, roughly 50 lines a second on a rig measured at 50 fps. Because it sat outside the guard, every earlier throttle fix missed it -- baseball 1.20.4, football, and #308 for hockey/basketball/lacrosse all inspected the guard rather than the whole function body. It has been there since the plugin landed in #24. Both branches now share one throttle in baseball-scoreboard's shape: log when the answer changes, and re-log an unchanged answer once per 60s so a steady state stays visible. test_live_content_log_throttle.py is ported from baseball's, plus a case for the exact state that triggered it -- a live card with favorites configured and none of them fighting, where ufc_live is False but live_games is not empty. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014RRtqXDCnvnY6EQwhT5CV9
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 17 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug
has_live_content()is called from the display path — once per frame in Vegas mode. UFC throttled only theFalsebranch:Whenever a card was live, that first call fired on every frame — roughly 50 lines/second on a rig measured at 50 fps.
Why it survived every previous fix
It sits outside the
should_logguard. baseball 1.20.4, football, and #308 (hockey/basketball/lacrosse) all inspected the guard rather than the whole function body, so none of them saw it. It has been there since the plugin landed in #24 (2026-02-13).Audited state across the lineage before this change:
has_live_contentThe fix
Both branches now share one throttle in baseball-scoreboard's shape — log on state change, re-log an unchanged answer once per 60s so a steady state stays visible.
Testing
test_live_content_log_throttle.py, ported from baseball's, plus a case for the exact state that triggered this: a live card with favorites configured and none of them fighting, soufc_liveis False whilelive_gamesis not empty. Verified it fails against the pre-fix manager.scripts/check_plugin.py --plugin ufc-scoreboard: 24/24 PASS across all 8 panel sizes.🤖 Generated with Claude Code
https://claude.ai/code/session_014RRtqXDCnvnY6EQwhT5CV9