diff --git a/src/dbos-executor.ts b/src/dbos-executor.ts index 43bcf045c..d1159fce2 100644 --- a/src/dbos-executor.ts +++ b/src/dbos-executor.ts @@ -619,7 +619,7 @@ export class DBOSExecutor { const wfInfo: WorkflowInfo | undefined = this.workflowInfoMap.get(wfStatus.workflowName); if (wfInfo) { - return this.workflow(wfInfo.workflow, { workflowUUID: workflowUUID, parentCtx: parentCtx ?? undefined }, ...inputs); + return this.workflow(wfInfo.workflow, { workflowUUID: workflowUUID, parentCtx: parentCtx ?? undefined }, ...inputs); } // Should be temporary workflows. Parse the name of the workflow. @@ -658,7 +658,6 @@ export class DBOSExecutor { this.logger.error(`Unrecognized temporary workflow! UUID ${workflowUUID}, name ${wfName}`) throw new DBOSNotRegisteredError(wfName); } - return this.workflow(temp_workflow, { workflowUUID: workflowUUID, parentCtx: parentCtx ?? undefined }, ...inputs); } @@ -727,7 +726,6 @@ export class DBOSExecutor { } } this.logger.debug(sqlStmt); - await this.userDatabase.query(sqlStmt, ...values); // Clean up after each batch succeeds diff --git a/src/debugger/debug_workflow.ts b/src/debugger/debug_workflow.ts index 6428f0aa3..16f3b6c20 100644 --- a/src/debugger/debug_workflow.ts +++ b/src/debugger/debug_workflow.ts @@ -216,7 +216,7 @@ export class WorkflowContextDebug extends DBOSContextImpl implements WorkflowCon const functionID: number = this.functionIDGetIncrement(); // Original result must exist during replay. - const check: NonNullable | null | DBOSNull = await this.#dbosExec.systemDatabase.checkOperationOutput | null>(this.workflowUUID, functionID); + const check: T | null | DBOSNull = await this.#dbosExec.systemDatabase.checkOperationOutput(this.workflowUUID, functionID); if (check === dbosNull) { throw new DBOSDebuggerError(`Cannot find recorded recv. Shouldn't happen in debug mode!`); } @@ -238,7 +238,7 @@ export class WorkflowContextDebug extends DBOSContextImpl implements WorkflowCon const functionID: number = this.functionIDGetIncrement(); // Original result must exist during replay. - const check: NonNullable | null | DBOSNull = await this.#dbosExec.systemDatabase.checkOperationOutput | null>(this.workflowUUID, functionID); + const check: T | null | DBOSNull = await this.#dbosExec.systemDatabase.checkOperationOutput(this.workflowUUID, functionID); if (check === dbosNull) { throw new DBOSDebuggerError(`Cannot find recorded getEvent. Shouldn't happen in debug mode!`); } diff --git a/src/system_database.ts b/src/system_database.ts index 5d3d2247e..9a81207c3 100644 --- a/src/system_database.ts +++ b/src/system_database.ts @@ -446,14 +446,14 @@ export class PostgresSystemDatabase implements SystemDatabase { AND notifications.created_at_epoch_ms = oldest_entry.created_at_epoch_ms RETURNING notifications.*;`, [workflowUUID, topic])).rows; - let message: NonNullable| null = null; + let message: T | null = null; if (finalRecvRows.length > 0) { - message = JSON.parse(finalRecvRows[0].message) as NonNullable; + message = JSON.parse(finalRecvRows[0].message) as T } await this.recordNotificationOutput(client, workflowUUID, functionID, message); await client.query(`COMMIT`); client.release(); - return message as T; + return message; } async setEvent(workflowUUID: string, functionID: number, key: string, message: NonNullable): Promise { @@ -511,14 +511,14 @@ export class PostgresSystemDatabase implements SystemDatabase { clearTimeout(timer!); // Return the value if it's in the DB, otherwise return null. - let value: NonNullable | null = null; + let value: T | null = null; if (initRecvRows.length > 0) { - value = JSON.parse(initRecvRows[0].value) as NonNullable; + value = JSON.parse(initRecvRows[0].value) as T; } else { // Read it again from the database. const finalRecvRows = (await this.pool.query(`SELECT value FROM ${DBOSExecutor.systemDBSchemaName}.workflow_events WHERE workflow_uuid=$1 AND key=$2;`, [workflowUUID, key])).rows; if (finalRecvRows.length > 0) { - value = JSON.parse(finalRecvRows[0].value) as NonNullable; + value = JSON.parse(finalRecvRows[0].value) as T; } } @@ -526,7 +526,7 @@ export class PostgresSystemDatabase implements SystemDatabase { if (callerUUID !== undefined && functionID !== undefined) { await this.recordOperationOutput(callerUUID, functionID, value); } - return value as T; + return value; } async getWorkflowStatus(workflowUUID: string, callerUUID?: string, functionID?: number): Promise {