Skip to content

Bound direct-dispatch capability retention for dynamic destinations #138

Closed

Description

@thomhurst

Claude identified a separate cache-lifetime concern while reviewing #135: PostgreSqlDirectDispatcher._capabilities retains every successful (Transport, Destination) lookup until worker disposal (src/Relayer.Outbox.PostgreSql/PostgreSqlDirectDispatcher.cs, field and DispatchAsync). Applications using continuously changing tenant destinations retain all destination strings and capability entries, even after durable messages complete.

Reproduction: dispatch committed unordered messages to successively unique destinations through a long-lived worker. The dictionary count grows with total historical destinations rather than active work.

Expected: bounded retained capability state while preserving destination-specific native limits. Caching only by transport is unsafe because GetCapabilities(endpoint) and MaxBatchSize can vary by endpoint.

Acceptance criteria:

  • Choose and document a bounded cache or lifecycle policy that preserves endpoint-specific capabilities and native batch limits.
  • Add deterministic coverage for many distinct destinations and repeated hot destinations.
  • Measure any changed steady-state lookup/allocation cost under D18 before choosing a performance trade-off; retain raw benchmark evidence outside the repository.
  • Keep Native AOT and single-worker access guarantees; update the direct-dispatch reference page if configuration or observable behavior changes.

This is separate from #135's blocking group-isolation fix. Its current successful dispatch lookup policy remains unchanged.

Activity

  1. added
    bug
    phase-2: outbox
    area: outbox
    P2
    on Nov 1, 2026
  2. added
    in-progress
    on Nov 1, 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

    P2area: outboxbugin-progressphase-2: outbox

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions