From 9f5992c1eaa9b15152c68b2984305383f0d8d901 Mon Sep 17 00:00:00 2001 From: moneromooo Date: Sun, 25 Jan 2015 21:35:34 +0000 Subject: [PATCH] Allow forcing refresh of the tipbot balance --- tipbot/betutils.py | 4 ++-- tipbot/utils.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tipbot/betutils.py b/tipbot/betutils.py index 829c3b7..5168e36 100644 --- a/tipbot/betutils.py +++ b/tipbot/betutils.py @@ -264,8 +264,8 @@ def ResetGameStats(link,sidentity,game): log_error('Error resetting %s stats for %s: %s' % (game,sidentity,str(e))) raise -def RetrieveHouseBalance(): - balance, unlocked_balance = RetrieveTipbotBalance() +def RetrieveHouseBalance(force_refresh=False): + balance, unlocked_balance = RetrieveTipbotBalance(force_refresh) house_balance = unlocked_balance user_balances=0 diff --git a/tipbot/utils.py b/tipbot/utils.py index 58d9554..ebd564f 100644 --- a/tipbot/utils.py +++ b/tipbot/utils.py @@ -188,9 +188,9 @@ def SendDaemonJSONRPCCommand(method,params): def SendDaemonHTMLCommand(method): return SendHTMLCommand(config.daemon_host,config.daemon_port,method) -def RetrieveTipbotBalance(): +def RetrieveTipbotBalance(force_refresh=False): global cached_tipbot_balance, cached_tipbot_unlocked_balance, cached_tipbot_balance_timestamp - if cached_tipbot_balance_timestamp and time.time()-cached_tipbot_balance_timestamp < config.tipbot_balance_cache_time: + if not force_refresh and cached_tipbot_balance_timestamp and time.time()-cached_tipbot_balance_timestamp < config.tipbot_balance_cache_time: return cached_tipbot_balance, cached_tipbot_unlocked_balance j = SendWalletJSONRPCCommand("getbalance",None)