fix(invalid connection again) 定期处理长时间连接

1. 减少了处理时间间隔
2. 处理策略更改为 超过 1小时没有动的连接就干掉
pull/104/head
ibuler 2016-02-29 17:07:53 +08:00
parent 5d28a6e402
commit 3c610668b5
1 changed files with 9 additions and 4 deletions

View File

@ -91,12 +91,17 @@ def kill_invalid_connection():
log_file_mtime = 0
if (now_timestamp - log_file_mtime) > 3600:
try:
os.kill(int(log.pid), 9)
except OSError:
pass
if log.login_type == 'ssh':
try:
os.kill(int(log.pid), 9)
except OSError:
pass
elif (now - log.start_time).days < 1:
continue
log.is_finished = True
log.end_time = now
log.save()