Skip to content

Commit c29d6db

Browse files
macdiceCommitfest Bot
authored andcommitted
Fix lost build row updates.
Sometimes poll_stale_build() has to insert a build row with missing data, assuming it would be updated later in process_new_build_status(). That didn't actually happen, so we could finish up with some rows that had NULL columns. It would be nicer if those columns were NOT NULL and we didn't have to insert a sort of "dummy" row, but that's needed for serialisation. We could lock something else instead...
1 parent 3505ad2 commit c29d6db

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

cfbot_cirrus.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -432,18 +432,17 @@ def process_new_build_status(
432432
logging.info(
433433
"build %s %s -> %s [%s]", build_id, old_build_status, build_status, source
434434
)
435-
cursor.execute(
436-
"""update build
435+
else:
436+
logging.info("new build %s %s [%s]", build_id, build_status, source)
437+
cursor.execute(
438+
"""update build
437439
set status = %s,
438440
commit_id = coalesce(commit_id, %s),
439441
branch_name = coalesce(branch_name, %s),
440442
modified = now()
441443
where build_id = %s""",
442-
(build_status, commit_id, branch_name, build_id),
443-
)
444-
else:
445-
logging.info("new build %s %s [%s]", build_id, build_status, source)
446-
# caller inserted build
444+
(build_status, commit_id, branch_name, build_id),
445+
)
447446

448447
# maintain the history of status changes
449448
cursor.execute(

0 commit comments

Comments
 (0)