Skip to content

core: Async fetch + cache layer (lazy loading) #4

Closed

Description

@unhappychoice

Fast startup via cached-first + async-refresh pattern.

Runtime

  • tokio multi-thread runtime
  • Per-widget refresh task with its own refresh_interval timer
  • Shared State map: fetchers write, draw loop reads latest snapshot
  • Persist results to ~/.cache/splashboard/<widget-id>.json with TTL metadata

Startup flows

Default (cache-first, fast):

  1. Load cached payloads synchronously
  2. Render immediately (<50ms target)
  3. Spawn fetches in background; await completion with timeout before exit; persist
  4. Next invocation reads the just-refreshed cache

wait_for_fresh = true / --wait:

  1. Kick off all fetches
  2. Await first completion per widget (with per-widget timeout)
  3. Render with fresh data → exit

Hard requirement

Default path MUST NOT block shell startup perceptibly. Blown timeouts render stale cache with a visual staleness indicator rather than hanging.

Depends on

Activity

  1. added
    core
    on Apr 21, 2026
  2. added this to the v1.0 milestone on Apr 21, 2026
  3. added a commit that references this issue on Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    core

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions