Commit c324955d authored by Julien Muchembled's avatar Julien Muchembled

client: fix "signal only works in main thread" when adding a ZODB Mount Point to NEO

parent 79fca358
......@@ -12,6 +12,8 @@
#
##############################################################################
import app # set up signal handers early enough to do it in the main thread
if 1:
from hashlib import md5
from ZODB.Connection import Connection
......
......@@ -20,6 +20,7 @@ from neo.lib.locking import Empty
from random import shuffle
import heapq
import time
import weakref
from functools import partial
from ZODB.POSException import UndoError, StorageTransactionError, ConflictError
......@@ -57,6 +58,16 @@ if SignalHandler:
import signal
SignalHandler.registerHandler(signal.SIGUSR2, logging.reopen)
class app_set(weakref.WeakSet):
def on_log(self):
for app in self:
app.log()
app_set = app_set()
registerLiveDebugger(app_set.on_log)
class Application(object):
"""The client node application."""
......@@ -116,7 +127,7 @@ class Application(object):
# node connection attemps
self._connecting_to_master_node = Lock()
self.compress = compress
registerLiveDebugger(on_log=self.log)
app_set.add(self) # to register self.on_log
def __getattr__(self, attr):
if attr == 'pt':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment