Documentation
¶
Overview ¶
Package turnqueue serializes synchronous agent-originated turns per Session.
Index ¶
Constants ¶
const ( // MaxDepth bounds callers waiting behind a Session turn. Raise it only when // production fan-in shows legitimate bursts are being rejected. MaxDepth = 32 // HoldTimeout bounds queue admission, not the admitted turn. Revisit when // observed Session turns routinely create legitimate waits beyond this limit. HoldTimeout = 30 * time.Second )
Variables ¶
var ( ErrFull = errors.New("session turn queue is full") ErrTimeout = errors.New("timed out waiting for session turn admission") )
Functions ¶
This section is empty.
Types ¶
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue provides process-local FIFO fairness within one replica. Cluster-wide one-active-turn-per-Session belongs to #643, tracked under #637: its shared lease will replace every in-process admission guard for all turn ingress. Queue must remain only a fairness layer in front of that standard admission seam, never a send-specific correctness boundary competing with the lease.
func (*Queue) Enqueue ¶
func (q *Queue) Enqueue(ctx context.Context, key string, fn func(context.Context, context.Context, func() error) error) error
Enqueue runs fn in per-key FIFO order. beforeStart must be called by fn after acquiring the runtime single-flight guard and before appending input or starting tools. It closes the cancellation race in the same way as the channel queue's EnqueueControl started contract: a timeout/cancellation that returns before admission makes every later beforeStart fail.