Skip to content

perf(lesson): harden GraphQL metadata path with timeout + fallback #1563

@joelhooks

Description

@joelhooks

Problem

lesson.loadLessonMetadataFromGraphQL.graphql is a top latency/error hotspot in structured logs:

  • avg: ~836ms
  • p95: ~2069ms
  • errors: 476 (last ~24h)

lesson.loadLesson.summary ends up at ~1231ms avg / ~2783ms p95 partly due to this dependency.

Goal

Harden the GraphQL leg so lesson pages degrade gracefully and avoid retry/refetch cascades.

Proposed work

  • Add timeout + bounded retry for lesson metadata GraphQL fetch.
  • Add explicit fallback behavior when metadata fetch fails (serve known-safe minimal lesson data).
  • Emit structured outcome fields (status, timed_out, fallback_used, error_class).
  • Ensure client does not trigger duplicate recovery fetches when SSR already returned fallback data.

Acceptance

  • GraphQL metadata error rate reduced materially (target: >50% drop).
  • p95 for lesson.loadLesson.summary improves.
  • Fallback path is observable in Axiom and does not break playback/auth gating.

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/readyCan be picked up by an AI agentobservabilityStructured logging/metrics/telemetryperfPerformance workrefactor

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions