Skip to content

Commit b02f4f0

Browse files
committed
feat(run-engine): warn when ck vtime and queue-gates are both enabled
The vtime dequeue and TTL-expiry sweep do not yet enforce queue-gates/total- concurrency (deferred follow-up). Until they do, enabling both features together silently under-enforces on those paths and leaks a group slot on vtime expiry. Both flags are off in production; this warns at construction rather than letting the mis-enforcement pass unnoticed.
1 parent c4af9aa commit b02f4f0

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

  • internal-packages/run-engine/src/run-queue

internal-packages/run-engine/src/run-queue/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,6 +1488,19 @@ export class RunQueue {
14881488
});
14891489
this.logger = options.logger ?? new Logger("RunQueue", options.logLevel ?? "info");
14901490

1491+
// INTERIM: queue-gates and total-concurrency are integrated into the enqueue/ack/nack/
1492+
// dead-letter vtime commands but NOT yet into the vtime dequeue or TTL-expiry sweep, so
1493+
// with both features on those two paths under-enforce (and vtime expire would leak a
1494+
// group-concurrency slot). Warn loudly rather than enforce silently-wrong. Remove once
1495+
// the follow-up threads gates through ckDequeueLua and ckExpireTtlLua.
1496+
if (this.#ckVtimeEnabled && (options.gatesEnabled || options.totalConcurrencyEnabled)) {
1497+
this.logger.warn(
1498+
"RunQueue: ckVirtualTimeScheduling is enabled together with queue-gates/total-concurrency, " +
1499+
"but the virtual-time dequeue and TTL-expiry sweep do not yet enforce them. " +
1500+
"Do not enable both in production until the gate integration follow-up lands."
1501+
);
1502+
}
1503+
14911504
this.workerQueueResolver = new WorkerQueueResolver({ logger: this.logger });
14921505
this._meter = options.meter ?? getMeter("run-queue");
14931506

0 commit comments

Comments
 (0)