Overview
The Daily Worker runs once every 24 hours to generate Flash scenes for “Today in History” events. It identifies historically significant events without visualizations and queues them for rendering, helping populate the graph with rich content.The Daily Worker is controlled by the
DAILY_CRON_ENABLED feature flag and requires a JobManager instance.Configuration
Parameters
Constants
Environment Variables
Worker Lifecycle
Startup
Inapp/main.py:
Shutdown
Daily Workflow
Each 24-hour cycle follows this algorithm:1. Find Today’s Events
today_in_history() method queries the graph for all events matching the current month and day (regardless of year).
2. Filter Sceneless Events
flash_timepoint_id are candidates for generation.
3. Rank by Importance
score = degree + (layer × 2)
- Degree: Number of connections (popularity)
- Layer: Event importance tier (higher = more significant)
4. Generate Top Events
Example Run
On March 6, 2026:Ranking Strategy
The ranking algorithm prioritizes:- Well-connected events: High degree indicates multiple historical relationships
- High-layer events: Core historical events curated by humans
- Combination: Layer is weighted 2× higher than degree
Example Scores
Integration with JobManager
The Daily Worker usesJobManager for generation:
- Screens the query with the Judge
- Calls the Renderer to generate the scene
- Updates the graph node with
flash_timepoint_id - Returns the result
Resource Management
Rate Limiting
If Flash rate limits are hit:Monitoring
Track Daily Worker activity:Key Metrics
- Events found for today
- Events without scenes
- Scenes generated
- Generation failures
Error Handling
The Daily Worker gracefully handles failures:- No events found: Logged and skipped
- All events have scenes: Normal, nothing to do
- JobManager failure: Individual jobs fail but don’t crash worker
- Database errors: Logged and retried next cycle
Customization
Change Generation Limit
Adjust Interval
Custom Ranking
Best Practices
- Run during off-peak hours: Schedule the first run at midnight UTC
- Monitor Flash quota: Ensure sufficient credits for daily generations
- Check logs regularly: Watch for repeated failures
- Balance generation limits: More scenes = higher costs and load
The Daily Worker is designed to run indefinitely. It automatically recovers from transient errors and continues on the next cycle.