Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds 401 to status_forcelist #85

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions plaidcloud/rpc/connection/jsonrpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,23 +135,15 @@
class RPCRetry(Retry):
def __init__(self, *args, check_allow_transmit=None, **kwargs):
"""

Args:
check_allow_transmit (callable, optional): Method to call to check if retries are still to be made
This can be used to prevent retry of RPC methods once a workflow has been cancelled and the RPC fails
"""
if version.parse(urllib3.__version__) >= version.parse("1.26.0"):
kwargs.update(dict(
allowed_methods=['POST'],
status_forcelist=[500, 502, 504],
backoff_factor=0.1,
))
else:
kwargs.update(dict(
method_whitelist=['POST'],
status_forcelist=[500, 502, 504],
backoff_factor=0.1,
))
kwargs.update(dict(
allowed_methods=['POST'],
status_forcelist=[401, 500, 502, 504],
backoff_factor=0.1,
))
if 'connect' not in kwargs:
kwargs['connect'] = 5
super(RPCRetry, self).__init__(*args, **kwargs)
Expand All @@ -168,6 +160,7 @@
return True

def increment(self, *args, **kwargs):
print(f'Hit Retry, Request History Looks Like: {self.history}')
if not self.allow_transmit:
raise Exception('No more retries, RPC method has been cancelled')
return super(RPCRetry, self).increment(*args, **kwargs)
Expand Down Expand Up @@ -210,6 +203,7 @@
if response.get('ok'):
return response['result']
else:
print(f'Retry Object History: {retry.}')

Check warning on line 206 in plaidcloud/rpc/connection/jsonrpc.py

View workflow job for this annotation

GitHub Actions / PyLint

[PyLint] plaidcloud/rpc/connection/jsonrpc.py#L206

E0001: Parsing failed: 'f-string: expecting '=', or '!', or ':', or '}' (<unknown>, line 206)' (syntax-error)
Raw output
plaidcloud/rpc/connection/jsonrpc.py:206:57: E0001: Parsing failed: 'f-string: expecting '=', or '!', or ':', or '}' (<unknown>, line 206)' (syntax-error)
error = response['error']
if error.get('code') == WARNING_CODE:
raise Warning(error.get('message'))
Expand Down
Loading