|
36 | 36 | )
|
37 | 37 | from .models import (
|
38 | 38 | CfbotBranch,
|
| 39 | + CfbotTask, |
39 | 40 | CommitFest,
|
40 | 41 | Committer,
|
41 | 42 | MailThread,
|
@@ -1434,26 +1435,27 @@ def cfbot_ingest(message):
|
1434 | 1435 | # UPDATE.
|
1435 | 1436 | if "task_status" in message:
|
1436 | 1437 | 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 | + ) |
1457 | 1459 |
|
1458 | 1460 | # Remove any old tasks that are not related to this branch. These should
|
1459 | 1461 | # only be left over when we just updated the branch_id. Knowing if we just
|
|
0 commit comments