Skip to content

Commit fd36485

Browse files
committed
fix an issue where we might not store some log entries
1 parent cabe6e3 commit fd36485

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/api/internal/internal.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,14 @@ def post(self):
5050

5151
g.db.execute("""
5252
INSERT INTO console (job_id, output) VALUES (%s, %s);
53+
""", [job_id, log])
54+
g.db.commit() # Commit here, updating job state later on might fail
55+
56+
g.db.execute("""
5357
UPDATE job SET state = 'running', start_date = current_timestamp
54-
WHERE id = %s and state = 'scheduled'""", [job_id, log, job_id])
58+
WHERE id = %s
59+
AND state = 'scheduled'
60+
""", [job_id])
5561
g.db.commit()
5662

5763
return {}
58-

0 commit comments

Comments
 (0)