Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
5
Merge Requests
5
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
slapos.toolbox
Commits
38d7dae0
Commit
38d7dae0
authored
Feb 06, 2019
by
Bryton Lacquement
🚪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check_error_on_zope_longrequest_log: work in binary mode when seeking
parent
b97cb913
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
slapos/promise/plugin/check_error_on_zope_longrequest_log.py
slapos/promise/plugin/check_error_on_zope_longrequest_log.py
+4
-4
No files found.
slapos/promise/plugin/check_error_on_zope_longrequest_log.py
View file @
38d7dae0
...
...
@@ -7,7 +7,7 @@ import os
import
sys
import
re
r
=
re
.
compile
(
"^([0-9]+
\
-[
0
-9]+
\
-[
0
-9]+ [0-9]+
\
:[
0
-9]+
\
:[
0
-9]+)(
\
,[
0
-9]+) - ([A-z]+) (.*)$"
)
r
=
re
.
compile
(
b
"^([0-9]+
\
-[
0
-9]+
\
-[
0
-9]+ [0-9]+
\
:[
0
-9]+
\
:[
0
-9]+)(
\
,[
0
-9]+) - ([A-z]+) (.*)$"
)
@
implementer
(
interface
.
IPromise
)
class
RunPromise
(
GenericPromise
):
...
...
@@ -25,10 +25,10 @@ class RunPromise(GenericPromise):
self
.
logger
.
info
(
"log file does not exist: log check skipped"
)
return
0
with
open
(
log_file
)
as
f
:
with
open
(
log_file
,
"rb"
)
as
f
:
f
.
seek
(
0
,
2
)
block_end_byte
=
f
.
tell
()
f
.
seek
(
block_end_byte
-
min
(
block_end_byte
,
4096
*
10
),
0
)
f
.
seek
(
-
min
(
block_end_byte
,
4096
*
10
),
1
)
data
=
f
.
read
()
for
line
in
reversed
(
data
.
splitlines
()):
m
=
r
.
match
(
line
)
...
...
@@ -36,7 +36,7 @@ class RunPromise(GenericPromise):
continue
dt
,
_
,
level
,
msg
=
m
.
groups
()
try
:
t
=
time
.
strptime
(
dt
,
"%Y-%m-%d %H:%M:%S"
)
t
=
time
.
strptime
(
dt
.
decode
(
'utf-8'
)
,
"%Y-%m-%d %H:%M:%S"
)
except
ValueError
:
continue
if
maximum_delay
and
(
time
.
time
()
-
time
.
mktime
(
t
))
>
maximum_delay
:
...
...
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