Increase timeout values in Rest Client
delliott90 opened this issue · 2 comments
Is your feature request related to a problem? Please describe.
There are two general places where a default timeout is specified. The CONNECT_TIMEOUT_DEFAULT in the RestApiClient.py, which is currently set to 2 seconds, and DEFAULT_TIMEOUT in the TimeoutHTTPAdapter, which is currently set to 5 seconds. Now that stix-shifter supports async API calls, these values can be raised, or at least passed through as configurable options.
Describe the solution you'd like
Timeout values can be configured to be higher if needed.
Individual connectors will need to be looked as as I think some override the timeout value.
This may be related to #1493
If I understand the timeout issue right, it is caused by mixing the CPU-bound translation in IO-bound-intended asyncio (good for transmission). Increasing the timeout mitigates the problem, but the existence of the timeout indicates asyncio is blocked and not working as expected.
Another thing we may do is to educate users of stix-shifter on using the library: splitting translation and transmission as discussed in #1493 (comment) so asyncio will be effective---instead of simply calling translation and transmission as async functions, one needs to wrap the sync version of translation into run_in_executor()
or use multi-processing since translation in essence is a CPU-bound task, which may not be helpful to run in async mode.