From ab6a2d60eba1842e3544e33e7e29e3ca0b3751b2 Mon Sep 17 00:00:00 2001 From: moneromooo Date: Thu, 14 Sep 2017 10:33:56 +0100 Subject: [PATCH] Make RPC timeout configurable, and longer by default --- tipbot/config.py.example | 1 + tipbot/utils.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tipbot/config.py.example b/tipbot/config.py.example index fec0fb4..0d8cf2e 100644 --- a/tipbot/config.py.example +++ b/tipbot/config.py.example @@ -28,6 +28,7 @@ payment_confirmations = 6 tipbot_balance_cache_time = 35 # seconds site_game_salt = '' openalias_address = None +rpc_timeout = 180 admins = ["freenode:moneromooo", "freenode:moneromoo"] diff --git a/tipbot/utils.py b/tipbot/utils.py index 8e74e37..30300a2 100644 --- a/tipbot/utils.py +++ b/tipbot/utils.py @@ -215,7 +215,7 @@ def StringToUnits(s): def SendJSONRPCCommand(host,port,method,params): try: - http = httplib.HTTPConnection(host,port,timeout=20) + http = httplib.HTTPConnection(host,port,timeout=config.rpc_timeout) except Exception,e: log_error('SendJSONRPCCommand: Error connecting to %s:%u: %s' % (host, port, str(e))) raise @@ -252,7 +252,7 @@ def SendJSONRPCCommand(host,port,method,params): def SendHTMLCommand(host,port,method): try: - http = httplib.HTTPConnection(host,port,timeout=20) + http = httplib.HTTPConnection(host,port,timeout=config.rpc_timeout) except Exception,e: log_error('SendHTMLCommand: Error connecting to %s:%u: %s' % (host, port, str(e))) raise