-
Notifications
You must be signed in to change notification settings - Fork 771
Open
Labels
Type/BugneedTriageThe issue has to be inspected and labeled manuallyThe issue has to be inspected and labeled manuallyuserCategory/Compilation
Description
Description
The following code block throws a compilation error: commit not allowed here
public isolated function processHeartbeat(types:Heartbeat heartbeat) returns types:HeartbeatResponse|error {
transaction {
sql:ExecutionResult updateResult = check dbClient->execute(`
UPDATE runtimes
SET status = ${heartbeat.status},
last_heartbeat = ${heartbeat.timestamp}
WHERE runtime_id = ${heartbeat.runtimeId}
`);
if updateResult.affectedRowCount == 0 {
rollback;
return error(string `Runtime ${heartbeat.runtimeId} not found`);
}
_ = check dbClient->execute(`
DELETE FROM runtime_services WHERE runtime_id = ${heartbeat.runtimeId}
`);
check commit;
return {
acknowledged: true
};
} on fail error e {
return error(string `Failed to process heartbeat for runtime ${heartbeat.runtimeId}`, e);
}
}
The same code works when the if block is commented or an else block is added.
if updateResult.affectedRowCount == 0 {
rollback;
return error(string `Runtime ${heartbeat.runtimeId} not found`);
}
Steps to Reproduce
No response
Affected Version(s)
2201.12.7
OS, DB, other environment details and versions
No response
Related area
-> Compilation
Related issue(s) (optional)
No response
Suggested label(s) (optional)
No response
Suggested assignee(s) (optional)
No response
Metadata
Metadata
Assignees
Labels
Type/BugneedTriageThe issue has to be inspected and labeled manuallyThe issue has to be inspected and labeled manuallyuserCategory/Compilation