Skip to content

Commit 4a14b4d

Browse files
committed
fix(agents): satisfy session lock drain lint
1 parent e66dc69 commit 4a14b4d

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

src/agents/embedded-agent-runner/run/attempt.session-lock.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -659,23 +659,28 @@ export async function createEmbeddedAttemptSessionLockController(params: {
659659
}
660660

661661
async function waitForHeldLockDrain(): Promise<void> {
662-
while (heldLockDraining) {
662+
for (;;) {
663+
if (!heldLockDraining) {
664+
return;
665+
}
663666
await new Promise<void>((resolve) => {
664667
heldLockDrainWaiters.add(resolve);
665668
});
666669
}
667670
}
668671

669672
async function beginHeldLockDrain(): Promise<symbol> {
670-
while (heldLockDraining) {
673+
for (;;) {
674+
if (!heldLockDraining) {
675+
const owner = Symbol("held-lock-drain");
676+
heldLockDraining = true;
677+
heldLockDrainOwner = owner;
678+
return owner;
679+
}
671680
await new Promise<void>((resolve) => {
672681
heldLockDrainWaiters.add(resolve);
673682
});
674683
}
675-
const owner = Symbol("held-lock-drain");
676-
heldLockDraining = true;
677-
heldLockDrainOwner = owner;
678-
return owner;
679684
}
680685

681686
function finishHeldLockDrain(owner: symbol): void {

0 commit comments

Comments
 (0)