Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
5d28a6e4
Commit
5d28a6e4
authored
Feb 29, 2016
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(invalid connection) 定期处理长时间连接
1. 减少了处理时间间隔 2. 处理策略更改为 超过 1小时没有动的连接就干掉
parent
cba53bba
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
6 deletions
+2
-6
log_api.py
jlog/log_api.py
+1
-5
settings.py
jumpserver/settings.py
+1
-1
No files found.
jlog/log_api.py
View file @
5d28a6e4
...
@@ -80,15 +80,11 @@ def renderTemplate(script_path, time_file_path, dimensions=(24, 80), templatenam
...
@@ -80,15 +80,11 @@ def renderTemplate(script_path, time_file_path, dimensions=(24, 80), templatenam
def
kill_invalid_connection
():
def
kill_invalid_connection
():
long_time_logs
=
[]
unfinished_logs
=
Log
.
objects
.
filter
(
is_finished
=
False
)
unfinished_logs
=
Log
.
objects
.
filter
(
is_finished
=
False
)
now
=
datetime
.
datetime
.
now
()
now
=
datetime
.
datetime
.
now
()
now_timestamp
=
int
(
time
.
mktime
(
now
.
timetuple
()))
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
:
try
:
log_file_mtime
=
int
(
os
.
stat
(
log
.
log_path
)
.
st_mtime
)
log_file_mtime
=
int
(
os
.
stat
(
log
.
log_path
)
.
st_mtime
)
except
OSError
:
except
OSError
:
...
...
jumpserver/settings.py
View file @
5d28a6e4
...
@@ -155,5 +155,5 @@ BOOTSTRAP_COLUMN_COUNT = 10
...
@@ -155,5 +155,5 @@ BOOTSTRAP_COLUMN_COUNT = 10
CRONJOBS
=
[
CRONJOBS
=
[
(
'0 1 * * *'
,
'jasset.asset_api.asset_ansible_update_all'
),
(
'0 1 * * *'
,
'jasset.asset_api.asset_ansible_update_all'
),
(
'
1
* * * *'
,
'jlog.log_api.kill_invalid_connection'
),
(
'
*/10
* * * *'
,
'jlog.log_api.kill_invalid_connection'
),
]
]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment