Skip to content

Commit e89614b

Browse files
committed
[qa] Add more helpful RPC timeout message
Replace previous timeout('timed out',) exception with more detailed error.
1 parent 8463aaa commit e89614b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

qa/rpc-tests/test_framework/authproxy.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import decimal
4343
import json
4444
import logging
45+
import socket
4546
try:
4647
import urllib.parse as urlparse
4748
except ImportError:
@@ -161,7 +162,15 @@ def _batch(self, rpc_call_list):
161162
return self._request('POST', self.__url.path, postdata.encode('utf-8'))
162163

163164
def _get_response(self):
164-
http_response = self.__conn.getresponse()
165+
try:
166+
http_response = self.__conn.getresponse()
167+
except socket.timeout as e:
168+
raise JSONRPCException({
169+
'code': -344,
170+
'message': '%r RPC took longer than %f seconds. Consider '
171+
'using larger timeout for calls that take '
172+
'longer to return.' % (self._service_name,
173+
self.__conn.timeout)})
165174
if http_response is None:
166175
raise JSONRPCException({
167176
'code': -342, 'message': 'missing HTTP response from server'})

0 commit comments

Comments
 (0)