Skip to content

Gateway fleet queue, routing, lease forwarding, fleet-wide one-lease rule #118

Closed

Description

@V3RON

Part of #115 (ADR 0005, requirements 10–19, 26–29). Requires ADR 0004 (#114) and the gateway skeleton.

Scope

  • One gateway-side FIFO queue with timeoutMs (QUEUE_TIMEOUT), noWait (NO_CAPACITY), lease.cancel, and queued/queuePosition progress.
  • Dispatch on every queue or view change: oldest first, pass over requests no worker can serve now; send lease.request with noWait: true and a namespaced requester (gw:<gateway instance id>:<requester>); NO_CAPACITY refreshes that worker's view and keeps the request queued.
  • Routing policy module selected by gateway.routing (same shape as CapacityStrategy). v1: drop disconnected/drained/lacking-catalog workers (downloads only where the worker's policy allows); prefer a matching unleased ready device; else most free running capacity for the platform.
  • Fleet-wide one-lease-per-requester from the gateway's lease index, rebuilt from each worker's lease.list on connect.
  • lease.renew, lease.release, lease.list, single-lease reads, and device.exec forward to the owning worker; the gateway lease id names its worker; lease object gains worker: { id, label }.
  • Progress and lease-scoped pushes (lease-lost, device-unhealthy, device-recovered) relayed to the owning gateway connection.
  • Ownership enforced at the gateway before anything is forwarded on the uplink's admin session.

Done when

  • With both workers full, a queued request is granted by whichever worker releases first.
  • A requester with a lease on worker A gets REQUESTER_ALREADY_LEASED naming it when asking again.
  • simlock adb shell getprop against the gateway reaches the device on the worker that holds it.

Activity

  1. 33 remaining items

  2. V3RON commented on Sep 9, 2026

    @V3RON
    ContributorAuthor

    Implemented in PR #130 (fleet queue, routing, lease forwarding, fleet-wide one-lease rule) and verified end-to-end by PR #132's smoke tests. Closing as done.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions