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
Xavier Thompson
erp5
Commits
a8b88c0b
Commit
a8b88c0b
authored
Jan 27, 2023
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zopewsgi: configure threads count and large_file_threshold with argparse
On Zope4 these settings are no longer in zope.conf
parent
cdfd7bed
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
6 deletions
+18
-6
product/ERP5/bin/zopewsgi.py
product/ERP5/bin/zopewsgi.py
+12
-4
product/ERP5Type/tests/ProcessingNodeTestCase.py
product/ERP5Type/tests/ProcessingNodeTestCase.py
+6
-2
No files found.
product/ERP5/bin/zopewsgi.py
View file @
a8b88c0b
...
...
@@ -84,7 +84,7 @@ class TransLogger(object):
self
.
logger
.
info
(
message
)
def
app_wrapper
(
large_file_threshold
=
10
<<
20
,
webdav_ports
=
()
):
def
app_wrapper
(
large_file_threshold
,
webdav_ports
):
try
:
from
Products.DeadlockDebugger.dumper
import
dump_threads
,
dump_url
except
Exception
:
...
...
@@ -163,6 +163,7 @@ def createServer(application, logger, **kw):
return
server
def
runwsgi
():
type_registry
=
ZConfig
.
datatypes
.
Registry
()
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'--event-log-file'
,
help
=
'Event log file'
)
parser
.
add_argument
(
'--access-log-file'
,
help
=
'Access log file'
)
...
...
@@ -171,12 +172,19 @@ def runwsgi():
parser
.
add_argument
(
'address'
,
help
=
'<ip>:<port>'
)
parser
.
add_argument
(
'zope_conf'
,
help
=
'path to zope.conf'
)
parser
.
add_argument
(
'--timerserver-interval'
,
help
=
'Interval for timerserver'
,
type
=
float
)
parser
.
add_argument
(
'--threads'
,
help
=
'Number of threads'
,
default
=
4
,
type
=
int
)
parser
.
add_argument
(
'--large-file-threshold'
,
help
=
'Requests bigger than this size in bytes get saved into a temporary file '
'instead of being read completely into memory.'
,
type
=
type_registry
.
get
(
'byte-size'
),
default
=
type_registry
.
get
(
'byte-size'
)(
"10MB"
))
args
=
parser
.
parse_args
()
startup
=
os
.
path
.
dirname
(
Zope2
.
Startup
.
__file__
)
if
os
.
path
.
isfile
(
os
.
path
.
join
(
startup
,
'wsgischema.xml'
)):
schema
=
ZConfig
.
loadSchema
(
os
.
path
.
join
(
startup
,
'wsgischema.xml'
))
else
:
# BBB
else
:
# BBB
Zope2
schema
=
ZConfig
.
loadSchema
(
os
.
path
.
join
(
startup
,
'zopeschema.xml'
))
conf
,
_
=
ZConfig
.
loadConfig
(
schema
,
args
.
zope_conf
)
...
...
@@ -238,11 +246,11 @@ def runwsgi():
port
=
int
(
port
)
createServer
(
app_wrapper
(
large_file_threshold
=
getattr
(
conf
,
'large_file_threshold'
,
None
)
,
large_file_threshold
=
args
.
large_file_threshold
,
webdav_ports
=
[
port
]
if
args
.
webdav
else
()),
listen
=
args
.
address
,
logger
=
access_log_logger
,
threads
=
getattr
(
conf
,
'zserver_threads'
,
4
)
,
threads
=
args
.
threads
,
asyncore_use_poll
=
True
,
# Prevent waitress from adding its own Via and Server response headers.
ident
=
None
,
...
...
product/ERP5Type/tests/ProcessingNodeTestCase.py
View file @
a8b88c0b
...
...
@@ -192,8 +192,12 @@ class ProcessingNodeTestCase(ZopeTestCase.TestCase):
logger
=
logging
.
getLogger
(
"access"
)
logger
.
addHandler
(
logging
.
FileHandler
(
log
))
logger
.
propagate
=
False
hs
=
createServer
(
app_wrapper
(
webdav_ports
=
webdav_ports
),
logger
,
sockets
=
sockets
)
hs
=
createServer
(
app_wrapper
(
large_file_threshold
=
10
<<
20
,
webdav_ports
=
webdav_ports
),
logger
,
sockets
=
sockets
)
ProcessingNodeTestCase
.
_server_address
=
hs
.
addr
t
=
Thread
(
target
=
hs
.
run
)
t
.
setDaemon
(
1
)
...
...
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