-
Notifications
You must be signed in to change notification settings - Fork 2
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
Rest communication secure multiple process #90
Conversation
…fferent session Ensure the lock is released just after the request has completed. Close all session upon deletion of the Communicator
if self._session is None: | ||
self._session = self.begin_session() | ||
return self._session | ||
pid = os.getpid() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add some comments to explain this process please, and possibly logs so we can peek into how this is working?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add docstring
@@ -97,6 +103,28 @@ def test_req(self, mocked_request): | |||
assert json.loads(response.content.decode('utf-8')) == response.json() == test_nested_request_content | |||
mocked_request.assert_called_with('METHOD', rest_url(test_endpoint), json=json_content) | |||
|
|||
@patched_failed_request | |||
def test_failed_req(self, mocked_request): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great
Create new session for every new process to avoid SSL errors.
Also ensure the lock is released in the event of an exception occurring during the request
See psf/requests#4323 and
https://stackoverflow.com/questions/3724900/python-ssl-problem-with-multiprocessing/3724938#3724938
fixes #91