mirror of https://github.com/jumpserver/jumpserver
fix(invalid connection) 定期处理长时间连接
1. 减少了处理时间间隔 2. 处理策略更改为 超过 1小时没有动的连接就干掉pull/104/head
parent
cba53bba55
commit
5d28a6e402
|
@ -80,15 +80,11 @@ def renderTemplate(script_path, time_file_path, dimensions=(24, 80), templatenam
|
|||
|
||||
|
||||
def kill_invalid_connection():
|
||||
long_time_logs = []
|
||||
unfinished_logs = Log.objects.filter(is_finished=False)
|
||||
now = datetime.datetime.now()
|
||||
now_timestamp = int(time.mktime(now.timetuple()))
|
||||
for log in unfinished_logs:
|
||||
if (now - log.start_time).days > 1:
|
||||
long_time_logs.append(log)
|
||||
|
||||
for log in long_time_logs:
|
||||
for log in unfinished_logs:
|
||||
try:
|
||||
log_file_mtime = int(os.stat(log.log_path).st_mtime)
|
||||
except OSError:
|
||||
|
|
|
@ -155,5 +155,5 @@ BOOTSTRAP_COLUMN_COUNT = 10
|
|||
|
||||
CRONJOBS = [
|
||||
('0 1 * * *', 'jasset.asset_api.asset_ansible_update_all'),
|
||||
('1 * * * *', 'jlog.log_api.kill_invalid_connection'),
|
||||
('*/10 * * * *', 'jlog.log_api.kill_invalid_connection'),
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue