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
Carlos Ramos Carreño
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
Show 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 @@
...
@@ -3,10 +3,7 @@
# Authors: Nik Kim <fafhrd@legco.biz>
# Authors: Nik Kim <fafhrd@legco.biz>
from
App.ImageFile
import
ImageFile
from
App.ImageFile
import
ImageFile
from
AccessControl
import
ModuleSecurityInfo
,
allow_module
from
.TimerService
import
TimerService
,
current_version
from
AccessControl.Permissions
import
view
from
TimerService
import
TimerService
,
current_version
misc_
=
{
'timer_icon.gif'
:
misc_
=
{
'timer_icon.gif'
:
ImageFile
(
'zpt/timer_icon.gif'
,
globals
())}
ImageFile
(
'zpt/timer_icon.gif'
,
globals
())}
...
...
product/TimerService/timerserver/TimerServer.py
View file @
bbb46d26
# -*- coding: UTF-8 -*-
# -*- coding: UTF-8 -*-
# -*- Mode: Python; py-indent-offset: 4 -*-
# -*- Mode: Python; py-indent-offset: 4 -*-
# Authors: Nik Kim <fafhrd@legco.biz>
# Authors: Nik Kim <fafhrd@legco.biz>
__version__
=
'TimerServer for Zope 0.1'
import
traceback
import
errno
,
logging
,
os
,
re
,
socket
,
sys
,
threading
,
time
,
traceback
import
thread
import
re
import
sys
,
os
,
errno
,
time
,
socket
from
functools
import
partial
from
functools
import
partial
from
urlparse
import
urlsplit
from
urlparse
import
urlsplit
from
StringIO
import
StringIO
from
StringIO
import
StringIO
from
zLOG
import
LOG
,
INFO
from
ZPublisher.BaseRequest
import
BaseRequest
from
ZPublisher.BaseResponse
import
BaseResponse
from
ZPublisher.BaseResponse
import
BaseResponse
from
ZPublisher.HTTPRequest
import
HTTPRequest
from
ZPublisher.HTTPRequest
import
HTTPRequest
from
ZPublisher.HTTPResponse
import
HTTPResponse
from
ZPublisher.HTTPResponse
import
HTTPResponse
import
ZPublisher.HTTPRequest
import
ZPublisher.HTTPRequest
class
TimerServer
:
logger
=
logging
.
getLogger
(
'TimerServer'
)
class
TimerServer
(
threading
.
Thread
):
def
__init__
(
self
,
module
,
interval
=
600
):
def
__init__
(
self
,
module
,
interval
=
600
):
super
(
TimerServer
,
self
).
__init__
()
self
.
daemon
=
True
self
.
module
=
module
self
.
module
=
module
self
.
interval
=
interval
self
.
interval
=
interval
self
.
start
()
sync
=
thread
.
allocate_lock
()
logger
.
info
(
'Service initialized with interval of %s second(s).'
,
interval
)
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
))
def
run
(
self
):
def
run
(
self
):
try
:
try
:
...
@@ -104,7 +91,7 @@ class TimerServer:
...
@@ -104,7 +91,7 @@ class TimerServer:
module
=
self
.
module
module
=
self
.
module
interval
=
self
.
interval
interval
=
self
.
interval
LOG
(
'ZServer'
,
INFO
,
'Timerserver ready, starting timer services
.'
)
logger
.
info
(
'Service ready
.'
)
while
1
:
while
1
:
time
.
sleep
(
interval
)
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