Cleanup not useful connections after 5 min
This commit is contained in:
parent
dbdde65f52
commit
e9af4a5f6b
1 changed files with 6 additions and 2 deletions
|
@ -192,11 +192,11 @@ class ConnectionServer:
|
||||||
|
|
||||||
elif idle > 20 * 60 and connection.last_send_time < time.time() - 10:
|
elif idle > 20 * 60 and connection.last_send_time < time.time() - 10:
|
||||||
# Idle more than 20 min and we have not sent request in last 10 sec
|
# Idle more than 20 min and we have not sent request in last 10 sec
|
||||||
if not connection.ping(): # send ping request
|
if not connection.ping():
|
||||||
connection.close()
|
connection.close()
|
||||||
|
|
||||||
elif idle > 10 and connection.incomplete_buff_recv > 0:
|
elif idle > 10 and connection.incomplete_buff_recv > 0:
|
||||||
# Incompelte data with more than 10 sec idle
|
# Incomplete data with more than 10 sec idle
|
||||||
connection.log("[Cleanup] Connection buff stalled")
|
connection.log("[Cleanup] Connection buff stalled")
|
||||||
connection.close()
|
connection.close()
|
||||||
|
|
||||||
|
@ -215,6 +215,10 @@ class ConnectionServer:
|
||||||
connection.log("[Cleanup] Too many bad actions: %s" % connection.bad_actions)
|
connection.log("[Cleanup] Too many bad actions: %s" % connection.bad_actions)
|
||||||
connection.close()
|
connection.close()
|
||||||
|
|
||||||
|
elif idle > 5*60 and connection.sites == 0:
|
||||||
|
connection.log("[Cleanup] No site for connection")
|
||||||
|
connection.close()
|
||||||
|
|
||||||
elif run_i % 30 == 0:
|
elif run_i % 30 == 0:
|
||||||
# Reset bad action counter every 30 min
|
# Reset bad action counter every 30 min
|
||||||
connection.bad_actions = 0
|
connection.bad_actions = 0
|
||||||
|
|
Loading…
Reference in a new issue