Skip to content

Commit f815f2f

Browse files
committed
Ignore tasks with unknown statusses
1 parent 190d0dc commit f815f2f

File tree

1 file changed

+22
-20
lines changed

1 file changed

+22
-20
lines changed

pgcommitfest/commitfest/views.py

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
)
3737
from .models import (
3838
CfbotBranch,
39+
CfbotTask,
3940
CommitFest,
4041
Committer,
4142
MailThread,
@@ -1434,26 +1435,27 @@ def cfbot_ingest(message):
14341435
# UPDATE.
14351436
if "task_status" in message:
14361437
task_status = message["task_status"]
1437-
cursor.execute(
1438-
"""INSERT INTO commitfest_cfbottask (task_id, task_name, patch_id, branch_id,
1439-
position, status,
1440-
created, modified)
1441-
VALUES (%s, %s, %s, %s, %s, %s, %s, %s)
1442-
ON CONFLICT (task_id) DO UPDATE
1443-
SET status = EXCLUDED.status,
1444-
modified = EXCLUDED.modified
1445-
WHERE commitfest_cfbottask.modified < EXCLUDED.modified""",
1446-
(
1447-
task_status["task_id"],
1448-
task_status["task_name"],
1449-
patch_id,
1450-
branch_id,
1451-
task_status["position"],
1452-
task_status["status"],
1453-
task_status["created"],
1454-
task_status["modified"],
1455-
),
1456-
)
1438+
if task_status["status"] in [x[0] for x in CfbotTask.STATUS_CHOICES]:
1439+
cursor.execute(
1440+
"""INSERT INTO commitfest_cfbottask (task_id, task_name, patch_id, branch_id,
1441+
position, status,
1442+
created, modified)
1443+
VALUES (%s, %s, %s, %s, %s, %s, %s, %s)
1444+
ON CONFLICT (task_id) DO UPDATE
1445+
SET status = EXCLUDED.status,
1446+
modified = EXCLUDED.modified
1447+
WHERE commitfest_cfbottask.modified < EXCLUDED.modified""",
1448+
(
1449+
task_status["task_id"],
1450+
task_status["task_name"],
1451+
patch_id,
1452+
branch_id,
1453+
task_status["position"],
1454+
task_status["status"],
1455+
task_status["created"],
1456+
task_status["modified"],
1457+
),
1458+
)
14571459

14581460
# Remove any old tasks that are not related to this branch. These should
14591461
# only be left over when we just updated the branch_id. Knowing if we just

0 commit comments

Comments
 (0)