Handle timeouts when downloading/uploading files
... to avoid errors like 'Unable to download input file: HTTP 599: Timeout'.
Default connect and request timeouts are 20 seconds which appears to be not enough for agents running on far sites.
I suggest to increase the timeouts a bit (say to 30 seconds) and implement handling of timeouts using the BacklogClient approach described here: https://github.com/tornadoweb/tornado/issues/1400
Also consider adding configuration parameter to enable the use of
curl_httpclient in AsyncHTTPClient.