Remove TFW antipattern I wrote without thinking

This commit is contained in:
Kristóf Tóth 2018-03-07 14:47:24 +01:00
parent 2c816d5a38
commit d11d9a70cb

View File

@ -2,7 +2,6 @@ from functools import wraps
from tfw.event_handler_base import TriggerlessEventHandler
from tfw.components.mixins import SupervisorMixin
from tfw.networking.event_handlers.server_connector import ServerUplinkConnector
from tfw.config.logs import logging
log = logging.getLogger(__name__)
@ -23,7 +22,6 @@ class ProcessManagingEventHandler(TriggerlessEventHandler):
self.key = key
self.monitor = dirmonitor
self.processmanager = ProcessManager()
self.uplink = ServerUplinkConnector()
def _with_monitor_paused(fun):
@wraps(fun)
@ -39,6 +37,6 @@ class ProcessManagingEventHandler(TriggerlessEventHandler):
try:
data = data_json['data']
self.processmanager(data['command'], data['process_name'])
self.uplink.send(self.key, {'data': {'process_name': data['process_name']}})
return data_json
except KeyError:
log.error('IGNORING MESSAGE: Invalid data_json received: {}'.format(data_json))