fix: render run immediately
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user