Skip to content

Commit 39f41a1

Browse files
committed
fix: ensure++
1 parent c97d32c commit 39f41a1

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/typegate/engine/src/runtimes/substantial.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ pub struct NextRunInput {
213213
pub exclude: Vec<String>,
214214
}
215215

216-
#[tracing::instrument(ret, level = "debug", skip(state, input))]
216+
// #[tracing::instrument(ret, level = "debug", skip(state, input))]
217217
#[deno_core::op2(async)]
218218
#[serde]
219219
pub async fn op_sub_agent_next_run(

src/typegate/src/runtimes/substantial/agent.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ export class Agent {
269269

270270
if (isRunning && isAboutToExpire) {
271271
this.logger.info(`Renew lease ${runId}, worker is still active`);
272+
272273
await Meta.substantial.agentRenewLease({
273274
backend: this.backend,
274275
lease_seconds: this.config.leaseLifespanSec,
@@ -278,6 +279,12 @@ export class Agent {
278279

279280
if (!isRunning) {
280281
this.mustLockRunIds.delete(runId);
282+
this.logger.info(`Remove lease ${runId}`);
283+
await Meta.substantial.agentRemoveLease({
284+
backend: this.backend,
285+
lease_seconds: this.config.leaseLifespanSec,
286+
run_id: runId,
287+
});
281288
}
282289
}
283290
}
@@ -527,6 +534,8 @@ export class Agent {
527534
run_id: runId,
528535
lease_seconds: this.config.leaseLifespanSec,
529536
});
537+
538+
this.mustLockRunIds.delete(runId);
530539
}
531540
}
532541

0 commit comments

Comments
 (0)