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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
erp5
Commits
bbb46d26
Commit
bbb46d26
authored
Sep 13, 2019
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TimerServer: code cleanup
parent
2ff798bd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
28 deletions
+12
-28
product/TimerService/__init__.py
product/TimerService/__init__.py
+1
-4
product/TimerService/timerserver/TimerServer.py
product/TimerService/timerserver/TimerServer.py
+11
-24
No files found.
product/TimerService/__init__.py
View file @
bbb46d26
...
...
@@ -3,10 +3,7 @@
# Authors: Nik Kim <fafhrd@legco.biz>
from
App.ImageFile
import
ImageFile
from
AccessControl
import
ModuleSecurityInfo
,
allow_module
from
AccessControl.Permissions
import
view
from
TimerService
import
TimerService
,
current_version
from
.TimerService
import
TimerService
,
current_version
misc_
=
{
'timer_icon.gif'
:
ImageFile
(
'zpt/timer_icon.gif'
,
globals
())}
...
...
product/TimerService/timerserver/TimerServer.py
View file @
bbb46d26
# -*- coding: UTF-8 -*-
# -*- Mode: Python; py-indent-offset: 4 -*-
# Authors: Nik Kim <fafhrd@legco.biz>
__version__
=
'TimerServer for Zope 0.1'
import
traceback
import
thread
import
re
import
sys
,
os
,
errno
,
time
,
socket
import
errno
,
logging
,
os
,
re
,
socket
,
sys
,
threading
,
time
,
traceback
from
functools
import
partial
from
urlparse
import
urlsplit
from
StringIO
import
StringIO
from
zLOG
import
LOG
,
INFO
from
ZPublisher.BaseRequest
import
BaseRequest
from
ZPublisher.BaseResponse
import
BaseResponse
from
ZPublisher.HTTPRequest
import
HTTPRequest
from
ZPublisher.HTTPResponse
import
HTTPResponse
import
ZPublisher.HTTPRequest
class
TimerServer
:
logger
=
logging
.
getLogger
(
'TimerServer'
)
class
TimerServer
(
threading
.
Thread
):
def
__init__
(
self
,
module
,
interval
=
600
):
super
(
TimerServer
,
self
).
__init__
()
self
.
daemon
=
True
self
.
module
=
module
self
.
interval
=
interval
sync
=
thread
.
allocate_lock
()
self
.
_a
=
sync
.
acquire
self
.
_r
=
sync
.
release
self
.
_a
()
thread
.
start_new_thread
(
self
.
run
,
())
self
.
_r
()
LOG
(
'ZServer'
,
INFO
,
'Timer server started at %s
\
n
'
'
\
t
Interval: %s seconds.
\
n
'
%
(
time
.
ctime
(
time
.
time
()),
interval
))
self
.
start
()
logger
.
info
(
'Service initialized with interval of %s second(s).'
,
interval
)
def
run
(
self
):
try
:
...
...
@@ -104,7 +91,7 @@ class TimerServer:
module
=
self
.
module
interval
=
self
.
interval
LOG
(
'ZServer'
,
INFO
,
'Timerserver ready, starting timer services
.'
)
logger
.
info
(
'Service ready
.'
)
while
1
:
time
.
sleep
(
interval
)
...
...
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