@@ -446,36 +446,40 @@ def batch_review_failures(builds: list[swatbuild.Build],
446
446
def get_new_reviews () -> dict [tuple [swatbotrest .TriageStatus , Any ],
447
447
list [userdata .Triage ]]:
448
448
"""Get a list of new reviews waiting to be published on swatbot server."""
449
+
450
+ def update_userinfo (userinfo ):
451
+ for triage in userinfo .triages :
452
+ status = triage .status
453
+ comment = triage .comment
454
+ if not status :
455
+ continue
456
+
457
+ if not comment :
458
+ logger .warning ("Review for failure %s is missing comment: "
459
+ "skipping" , buildid )
460
+ continue
461
+
462
+ def is_pending (failure_id ):
463
+ pol = swatbotrest .RefreshPolicy .FORCE
464
+ failure = swatbotrest .get_stepfailure (failure_id ,
465
+ refresh_override = pol )
466
+ return failure ['attributes' ]['triage' ] == 0
467
+
468
+ # Make sure failures are still pending
469
+ triage .failures = {f for f in triage .failures if is_pending (f )}
470
+
471
+ if triage .failures :
472
+ reviews .setdefault ((status , comment ), []).append (triage )
473
+
449
474
userinfos = userdata .UserInfos ()
450
475
451
- logger .info ("Loading pending reviews..." )
452
476
reviews : dict [tuple [swatbotrest .TriageStatus , Any ],
453
477
list [userdata .Triage ]] = {}
454
- with click .progressbar (userinfos .items ()) as userinfos_progress :
455
- for buildid , userinfo in userinfos_progress :
456
- for triage in userinfo .triages :
457
- status = triage .status
458
- comment = triage .comment
459
- if not status :
460
- continue
461
-
462
- if not comment :
463
- logger .warning ("Review for failure %s is missing comment: "
464
- "skipping" , buildid )
465
- continue
466
-
467
- def is_pending (failure_id ):
468
- pol = swatbotrest .RefreshPolicy .FORCE
469
- failure = swatbotrest .get_stepfailure (failure_id ,
470
- refresh_override = pol )
471
- return failure ['attributes' ]['triage' ] == 0
472
-
473
- # Make sure failures are still pending
474
- triage .failures = {f for f in triage .failures if is_pending (f )}
475
-
476
- if triage .failures :
477
- reviews .setdefault ((status , comment ), []).append (triage )
478
+ executor = utils .ExecutorWithProgress (8 )
479
+ for buildid , userinfo in userinfos .items ():
480
+ executor .submit ("Updating pending review" , update_userinfo , userinfo )
478
481
482
+ executor .run ()
479
483
userinfos .save ()
480
484
481
485
return reviews
0 commit comments