You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.1 KiB
37 lines
1.1 KiB
3 years ago
|
import os
|
||
|
|
||
|
bind = '0.0.0.0:{{ paperless_port }}'
|
||
|
workers = int(os.getenv("PAPERLESS_WEBSERVER_WORKERS", 2))
|
||
|
worker_class = 'paperless.workers.ConfigurableWorker'
|
||
|
timeout = 120
|
||
|
|
||
|
def pre_fork(server, worker):
|
||
|
pass
|
||
|
|
||
|
def pre_exec(server):
|
||
|
server.log.info("Forked child, re-executing.")
|
||
|
|
||
|
def when_ready(server):
|
||
|
server.log.info("Server is ready. Spawning workers")
|
||
|
|
||
|
def worker_int(worker):
|
||
|
worker.log.info("worker received INT or QUIT signal")
|
||
|
|
||
|
## get traceback info
|
||
|
import threading, sys, traceback
|
||
|
id2name = dict([(th.ident, th.name) for th in threading.enumerate()])
|
||
|
code = []
|
||
|
for threadId, stack in sys._current_frames().items():
|
||
|
code.append("\n# Thread: %s(%d)" % (id2name.get(threadId,""),
|
||
|
threadId))
|
||
|
for filename, lineno, name, line in traceback.extract_stack(stack):
|
||
|
code.append('File: "%s", line %d, in %s' % (filename,
|
||
|
lineno, name))
|
||
|
if line:
|
||
|
code.append(" %s" % (line.strip()))
|
||
|
worker.log.debug("\n".join(code))
|
||
|
|
||
|
def worker_abort(worker):
|
||
|
worker.log.info("worker received SIGABRT signal")
|
||
|
|