--- title: "ADR 0051: The queue debug view never waits for the queue lock" --- * Status: accepted * Code: [`pkg/queue/debug.go`](https://github.com/tektoncd/pipelines-as-code/blob/main/pkg/queue/debug.go) ## Context The in-memory queue can disagree with the cluster, and `Manager.Snapshot` exposes it as JSON through `DebugHandler`. Snapshot reads the same `qm.lock` the reconciler holds to admit and release runs. The Manager is created after the watcher's HTTP server is set up. ## Decision * `Snapshot` uses `TryLock`. When the lock is held it returns `nil, false`, and `DebugHandler` answers 503 "queue manager is busy, try again" instead of waiting. * `RegisterForDebug` stores the Manager in a package variable guarded by an RWMutex. `DebugHandler` reads it per request and answers 503 "queue manager is not ready yet" while it is nil. * The handler is read-only and returns only the limit and the running and pending PipelineRun keys, sorted, per `namespace/repository`. ## Consequences * A diagnostic request can never stall admission or release; under contention the caller must retry. * The debug handler depends on a global registered once the Manager exists. * Whether the exposed names are sensitive is not decided in code; the source only notes that they can already be listed from the cluster.