ESPN4CC4C Updates – Padding, Scheduler, and Log Management
Just pushed a few updates to ESPN4CC4C that should make things a bit smoother and easier to manage.
Event Padding (for games that run long) – beta
This is a first pass at padding support, and I’m treating it as beta for now. Feedback welcome. The logic now looks at both is_reair and is_studio so we only pad truly live sports events.
- New env vars:
PADDING_START_MINS
PADDING_END_MINS
-
PADDING_LIVE_ONLY (defaults to true)
- With
PADDING_LIVE_ONLY=true (default), padding is applied only when:
-
is_reair = 0 and
is_studio = 0
In other words:
- Live games / competitions → padded
- Live studio shows → not padded
- Replays (games or studio) → not padded
- If you want to pad everything regardless of flags, you can set:
-
PADDING_LIVE_ONLY=false → padding is applied to all events.
Example:
-
PADDING_START_MINS=5 and PADDING_END_MINS=30 will start a live game 5 minutes early and extend it 30 minutes past the scheduled end time in the VC plan.
Padding is off by default (0 minutes), so existing setups behave exactly the same unless you turn it on. In the logs, the padding summary now reports non_live_events_skipped, which counts both studio shows and replays that were not padded.
Refresh Schedule
- Changed from three times a day (08:05 / 14:05 / 20:05) to once a day at 03:00.
- ESPN schedules don’t move around that often, so this cuts down on unnecessary DB churn.
- You can still manually kick off a refresh anytime via
/admin/refresh.
Log Rotation and Cleanup
- Plan builder now writes to a rotating JSONL log:
- Max 10 MB per file, keeps 3 backups.
- A weekly job cleans up older logs so things don’t grow forever.
- Net result: logs stay roughly in the ~50 MB range instead of creeping up over time.
Bug Fixes
- Fixed a critical filter bug:
- When filters exclude all events, the
events table is now actually cleared instead of just logging a warning.
- Fixed missing type imports that could cause import errors in some environments.
- Removed an old, unused helper around previous plan start times.
All of these changes are backwards-compatible. If you don’t touch the new padding env vars, it should behave exactly like before, and if you do enable padding, it now only applies to live sports events rather than studio shows or replays.