File tree Expand file tree Collapse file tree 1 file changed +49
-1
lines changed Expand file tree Collapse file tree 1 file changed +49
-1
lines changed Original file line number Diff line number Diff line change @@ -478,6 +478,54 @@ def submit_for_review(
478
478
f"Submit failed due to server-side intermittent issue. Will sleep for 1 minute and try again, left attempt: { max_attempts - 1 } ."
479
479
)
480
480
time .sleep (60 )
481
- self .submit_for_review (version_id = version_id , max_attempts = max_attempts - 1 )
481
+ self .submit_for_review (
482
+ version_id = version_id , max_attempts = max_attempts - 1
483
+ )
484
+ else :
485
+ raise # Re-raise the caught exception
486
+
487
+ def release (
488
+ self ,
489
+ * ,
490
+ version_id : str ,
491
+ max_attempts : int = 3 ,
492
+ ) -> None :
493
+ """Release an approved version
494
+
495
+ :param version_id: The ID of the version to release
496
+ :param max_attempts: The number of attempts allowed
497
+
498
+ :raises AppStoreConnectError: If runs into unretriable error or exceeds retry count
499
+ """
500
+
501
+ try :
502
+ self .log .info (f"Releasing version { version_id } " )
503
+
504
+ self .http_client .post (
505
+ endpoint = "appStoreVersionReleaseRequests" ,
506
+ data = {
507
+ "data" : {
508
+ "type" : "appStoreVersionReleaseRequests" ,
509
+ "relationships" : {
510
+ "appStoreVersion" : {
511
+ "data" : {"type" : "appStoreVersions" , "id" : version_id }
512
+ }
513
+ },
514
+ }
515
+ },
516
+ log_response = True ,
517
+ )
518
+
519
+ except AppStoreConnectError as ex :
520
+ if (
521
+ max_attempts > 0
522
+ and ex .response .status_code >= 500
523
+ and ex .response .status_code < 600
524
+ ):
525
+ self .log .info (
526
+ f"Submit failed due to server-side intermittent issue. Will sleep for 1 minute and try again, left attempt: { max_attempts - 1 } ."
527
+ )
528
+ time .sleep (60 )
529
+ self .release (version_id = version_id , max_attempts = max_attempts - 1 )
482
530
else :
483
531
raise # Re-raise the caught exception
You can’t perform that action at this time.
0 commit comments