File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ class Options:
2222 client_id : str
2323 client_secret : str
2424 access_token_url : str
25+ retry_count : int = 10
26+ sleep_seconds : int = 3
2527
2628
2729class Client :
@@ -92,15 +94,16 @@ def _check_upload(
9294 self ,
9395 operation_id ,
9496 access_token : str ,
95- retry_count : int = 5 ,
96- sleep_seconds : int = 3 ,
9797 ) -> str :
9898 logger .debug ("Checking upload" )
9999
100100 upload_status = ""
101101 attempts = 0
102102
103- while upload_status != ResponseStatus .SUCCEEDED and attempts < retry_count :
103+ while (
104+ upload_status != ResponseStatus .SUCCEEDED
105+ and attempts < self .options .retry_count
106+ ):
104107 response = requests .get (
105108 self ._status_endpoint (operation_id ),
106109 headers = {
@@ -121,7 +124,8 @@ def _check_upload(
121124 response_json ["errors" ],
122125 )
123126 elif upload_status == ResponseStatus .IN_PROGRESS :
124- time .sleep (sleep_seconds )
127+ time .sleep (self .options .sleep_seconds )
128+ attempts += 1
125129
126130 return upload_status
127131
You can’t perform that action at this time.
0 commit comments