fix: render run immediately

This commit is contained in:
Rohit Rajan
2025-09-29 20:08:17 +05:30
parent e4c52376f2
commit 9a2d60ef4c
5 changed files with 43 additions and 11 deletions

View File

@@ -333,6 +333,12 @@ async function processRunExecution(job: Job<ExecuteRunData>) {
// Schedule updates for Google Sheets and Airtable
await triggerIntegrationUpdates(plainRun.runId, plainRun.robotMetaId);
// Flush any remaining persistence buffer before emitting socket event
if (browser && browser.interpreter) {
await browser.interpreter.flushPersistenceBuffer();
logger.log('debug', `Flushed persistence buffer before emitting run-completed for run ${data.runId}`);
}
const completionData = {
runId: data.runId,
robotMetaId: plainRun.robotMetaId,

View File

@@ -300,6 +300,10 @@ export class WorkflowInterpreter {
this.socket.emit('log', `----- The interpretation finished with status: ${status} -----`, false);
logger.log('debug', `Interpretation finished`);
// Flush any remaining data in persistence buffer before completing
await this.flushPersistenceBuffer();
this.interpreter = null;
this.socket.emit('activePairId', -1);
this.interpretationIsPaused = false;
@@ -606,9 +610,9 @@ export class WorkflowInterpreter {
/**
* Flushes persistence buffer to database in a single transaction
* @private
* @public - Made public to allow external flush before socket emission
*/
private async flushPersistenceBuffer(): Promise<void> {
public async flushPersistenceBuffer(): Promise<void> {
if (this.persistenceBuffer.length === 0 || this.persistenceInProgress || !this.currentRunId) {
return;
}