1 parent ecc8a11 commit 5cdf6d5Copy full SHA for 5cdf6d5
1 file changed
api/src/agent/agent.service.ts
@@ -305,9 +305,12 @@ export class HermesAgentService implements OnModuleInit {
305
if (pending.length === 0) {
306
return;
307
}
308
+
309
const batch = pending.splice(0, pending.length);
310
const rows = eventInsertRows(runId, batch, seq);
311
312
seq += batch.length;
313
314
chain = chain.then(() =>
315
this.prisma.agentEvent.createMany({ data: rows }).then(
316
() => undefined,
@@ -319,6 +322,7 @@ export class HermesAgentService implements OnModuleInit {
319
322
320
323
const subscription = this.langfuse.observe(runId).subscribe((ev) => pending.push(ev));
321
324
const timer = setInterval(flush, EVENT_FLUSH_INTERVAL_MS);
325
326
timer.unref?.(); // never hold the process open on this timer alone
327
328
return {
0 commit comments