[FIX] server.py: resource is not available on Windows
Rev.dcb56412d6introduces limits for the threadedserver It uses `resource` to set the hard limit, but unfortunately `resource` is not available on Windows. As in the GeventServer, we therefore set the resource hard limit within a `if os.name == 'posix'` block, as in rev.c68b41bff2
This commit is contained in:
@@ -341,13 +341,12 @@ class ThreadedServer(CommonServer):
|
||||
signal.signal(signal.SIGXCPU, self.signal_handler)
|
||||
signal.signal(signal.SIGQUIT, dumpstacks)
|
||||
signal.signal(signal.SIGUSR1, log_ormcache_stats)
|
||||
soft, hard = resource.getrlimit(resource.RLIMIT_AS)
|
||||
resource.setrlimit(resource.RLIMIT_AS, (config['limit_memory_hard'], hard))
|
||||
elif os.name == 'nt':
|
||||
import win32api
|
||||
win32api.SetConsoleCtrlHandler(lambda sig: self.signal_handler(sig, None), 1)
|
||||
|
||||
soft, hard = resource.getrlimit(resource.RLIMIT_AS)
|
||||
resource.setrlimit(resource.RLIMIT_AS, (config['limit_memory_hard'], hard))
|
||||
|
||||
test_mode = config['test_enable'] or config['test_file']
|
||||
if test_mode or (config['http_enable'] and not stop):
|
||||
# some tests need the http deamon to be available...
|
||||
|
||||
Reference in New Issue
Block a user