File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed
Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ def test_update_dataset(self):
9595
9696 # We need to wait for the changes in the dataset to propgate and be
9797 # eventually consistent. The alternative outcome is a 403 Forbidden
98- # response from upstream.
98+ # response from upstream due to upstream rate limiting .
9999 @Retry (Forbidden , tries = 2 , delay = 30 )
100100 def update_dataset ():
101101 dataset .update ()
@@ -201,7 +201,7 @@ def test_update_table(self):
201201
202202 # We need to wait for the changes in the dataset to propgate and be
203203 # eventually consistent. The alternative outcome is a 403 Forbidden
204- # response from upstream.
204+ # response from upstream due to upstream rate limiting .
205205 @Retry (Forbidden , tries = 2 , delay = 30 )
206206 def create_dataset ():
207207 dataset .create ()
Original file line number Diff line number Diff line change @@ -38,17 +38,20 @@ def __call__(self, to_wrap):
3838 @wraps (to_wrap )
3939 def wrapped_function (* args , ** kwargs ):
4040 tries_counter = self .tries
41+ exception = self .exception
42+ delay = self .delay
43+ backoff = self .backoff
4144 while tries_counter > 0 :
4245 try :
4346 return to_wrap (* args , ** kwargs )
44- except self . exception as caught_exception :
47+ except exception as caught_exception :
4548 msg = ("%s, Trying again in %d seconds..." %
46- (str (caught_exception ), self . delay ))
49+ (str (caught_exception ), delay ))
4750 self .logger (msg )
4851
49- time .sleep (self . delay )
52+ time .sleep (delay )
5053 tries_counter -= 1
51- self . delay *= self . backoff
54+ delay *= backoff
5255 return to_wrap (* args , ** kwargs )
5356
5457 return wrapped_function
You can’t perform that action at this time.
0 commit comments