Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Jérome Perrin
erp5
Commits
2b042f3e
Commit
2b042f3e
authored
Mar 05, 2023
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP clean shutdown
parent
8abbbd83
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
product/TimerService/timerserver/TimerServer.py
product/TimerService/timerserver/TimerServer.py
+11
-2
No files found.
product/TimerService/timerserver/TimerServer.py
View file @
2b042f3e
...
@@ -92,7 +92,7 @@ class TimerServer(threading.Thread):
...
@@ -92,7 +92,7 @@ class TimerServer(threading.Thread):
interval
=
self
.
interval
interval
=
self
.
interval
logger
.
info
(
'Service ready.'
)
logger
.
info
(
'Service ready.'
)
request_class
=
TimerRequest
while
1
:
while
1
:
time
.
sleep
(
interval
)
time
.
sleep
(
interval
)
# send message to zope
# send message to zope
...
@@ -100,7 +100,9 @@ class TimerServer(threading.Thread):
...
@@ -100,7 +100,9 @@ class TimerServer(threading.Thread):
out
=
StringIO
()
out
=
StringIO
()
err
=
StringIO
()
err
=
StringIO
()
response
=
TimerResponse
(
out
,
err
)
response
=
TimerResponse
(
out
,
err
)
handle
(
module
,
TimerRequest
(
response
,
interval
),
response
)
if
server
.
task_dispatcher
.
stop_count
:
request_class
=
ShutdownTimerRequest
handle
(
module
,
request_class
(
response
,
interval
),
response
)
except
Exception
:
except
Exception
:
logger
.
warn
(
"Ignoring exception in run loop"
,
exc_info
=
True
)
logger
.
warn
(
"Ignoring exception in run loop"
,
exc_info
=
True
)
...
@@ -186,3 +188,10 @@ class TimerRequest(HTTPRequest):
...
@@ -186,3 +188,10 @@ class TimerRequest(HTTPRequest):
clone
=
HTTPRequest
(
None
,
environ
,
HTTPResponse
(),
clean
=
1
)
clone
=
HTTPRequest
(
None
,
environ
,
HTTPResponse
(),
clean
=
1
)
clone
[
'PARENTS'
]
=
[
self
[
'PARENTS'
][
-
1
]]
clone
[
'PARENTS'
]
=
[
self
[
'PARENTS'
][
-
1
]]
return
clone
return
clone
class
ShutdownTimerRequest
(
TimerRequest
):
def
_get_env
(
self
,
stdin
):
env
=
super
(
ShutDownTimerRequest
,
self
).
_get_env
(
stdin
)
env
[
'PATH_INFO'
]
=
TIMER_SERVICE_PATH
+
'/process_shutdown'
return
env
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