[FIX] do not expose posix only config options on windows
bzr revid: chs@openerp.com-20140306115214-8wrfivy4runpzoar
This commit is contained in:
parent
e4488138f7
commit
ec36a494fe
|
@ -9,7 +9,10 @@ import os.path
|
|||
import platform
|
||||
import psutil
|
||||
import random
|
||||
if os.name == 'posix':
|
||||
import resource
|
||||
else:
|
||||
resource = None
|
||||
import select
|
||||
import signal
|
||||
import socket
|
||||
|
@ -638,6 +641,8 @@ class Worker(object):
|
|||
raise
|
||||
|
||||
def process_limit(self):
|
||||
if resource is None:
|
||||
return
|
||||
# If our parent changed sucide
|
||||
if self.ppid != os.getppid():
|
||||
_logger.info("Worker (%s) Parent changed", self.pid)
|
||||
|
|
|
@ -252,6 +252,7 @@ class configmanager(object):
|
|||
|
||||
# Advanced options
|
||||
group = optparse.OptionGroup(parser, "Advanced options")
|
||||
if os.name == 'posix':
|
||||
group.add_option('--auto-reload', dest='auto_reload', action='store_true', my_default=False, help='enable auto reload')
|
||||
group.add_option('--debug', dest='debug_mode', action='store_true', my_default=False, help='enable debug mode')
|
||||
group.add_option("--stop-after-init", action="store_true", dest="stop_after_init", my_default=False,
|
||||
|
@ -274,6 +275,7 @@ class configmanager(object):
|
|||
help="Use the unaccent function provided by the database when available.")
|
||||
parser.add_option_group(group)
|
||||
|
||||
if os.name == 'posix':
|
||||
group = optparse.OptionGroup(parser, "Multiprocessing options")
|
||||
# TODO sensible default for the three following limits.
|
||||
group.add_option("--workers", dest="workers", my_default=0,
|
||||
|
@ -405,12 +407,22 @@ class configmanager(object):
|
|||
'list_db', 'xmlrpcs', 'proxy_mode',
|
||||
'test_file', 'test_enable', 'test_commit', 'test_report_directory',
|
||||
'osv_memory_count_limit', 'osv_memory_age_limit', 'max_cron_threads', 'unaccent',
|
||||
'workers', 'limit_memory_hard', 'limit_memory_soft', 'limit_time_cpu', 'limit_time_real', 'limit_request',
|
||||
'auto_reload', 'data_dir',
|
||||
'data_dir',
|
||||
]
|
||||
|
||||
posix_keys = [
|
||||
'auto_reload', 'workers',
|
||||
'limit_memory_hard', 'limit_memory_soft',
|
||||
'limit_time_cpu', 'limit_time_real', 'limit_request',
|
||||
]
|
||||
|
||||
if os.name == 'posix':
|
||||
keys += posix_keys
|
||||
else:
|
||||
self.options.update(dict.fromkeys(posix_keys, None))
|
||||
|
||||
# Copy the command-line arguments...
|
||||
for arg in keys:
|
||||
# Copy the command-line argument...
|
||||
if getattr(opt, arg) is not None:
|
||||
self.options[arg] = getattr(opt, arg)
|
||||
# ... or keep, but cast, the config file value.
|
||||
|
|
Loading…
Reference in New Issue