From ff1c534eef33d1a788cfaee32fbbb5f11a2d61b4 Mon Sep 17 00:00:00 2001 From: Raanan Date: Mon, 16 May 2016 15:18:19 +0200 Subject: [PATCH] Prevent bot getting stuck, added timeout on socket level --- poloniex.py | 2 ++ www/lendingbot.html | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/poloniex.py b/poloniex.py index ab6a37ae..ffd923d9 100644 --- a/poloniex.py +++ b/poloniex.py @@ -3,6 +3,7 @@ import json import time import hmac,hashlib +import socket def createTimeStamp(datestr, format="%Y-%m-%d %H:%M:%S"): return time.mktime(time.strptime(datestr, format)) @@ -11,6 +12,7 @@ class Poloniex: def __init__(self, APIKey, Secret): self.APIKey = APIKey self.Secret = Secret + socket.setdefaulttimeout(30) def post_process(self, before): after = before diff --git a/www/lendingbot.html b/www/lendingbot.html index 0fbef3ee..408cb3c4 100644 --- a/www/lendingbot.html +++ b/www/lendingbot.html @@ -35,7 +35,7 @@ var table = $('#logtable'); table.empty(); for (var i = rowCount - 1; i >=0; i--) { - table.append('' + data.log[i] + ''); + table.append($('').append($('').text(data.log[i]))); } }