Skip to main content

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

In app/main.py:

Shutdown

Daily Workflow

Each 24-hour cycle follows this algorithm:

1. Find Today’s Events

The today_in_history() method queries the graph for all events matching the current month and day (regardless of year).

2. Filter Sceneless Events

Only events without flash_timepoint_id are candidates for generation.

3. Rank by Importance

Ranking formula: score = degree + (layer × 2)
  • Degree: Number of connections (popularity)
  • Layer: Event importance tier (higher = more significant)

4. Generate Top Events

Up to 5 top-ranked events are queued for scene generation.

Example Run

On March 6, 2026:

Ranking Strategy

The ranking algorithm prioritizes:
  1. Well-connected events: High degree indicates multiple historical relationships
  2. High-layer events: Core historical events curated by humans
  3. Combination: Layer is weighted 2× higher than degree

Example Scores

Integration with JobManager

The Daily Worker uses JobManager for generation:
The JobManager:
  1. Screens the query with the Judge
  2. Calls the Renderer to generate the scene
  3. Updates the graph node with flash_timepoint_id
  4. Returns the result

Resource Management

Generating 5 scenes daily at ~45 seconds each consumes approximately 3.75 minutes of Flash service time per day. Monitor your Flash quota accordingly.

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:
Key failure modes:
  • 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

  1. Run during off-peak hours: Schedule the first run at midnight UTC
  2. Monitor Flash quota: Ensure sufficient credits for daily generations
  3. Check logs regularly: Watch for repeated failures
  4. 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.