Introduce intent for TFW messages and fix FSM related bugs

This commit is contained in:
R. Richard
2019-08-23 15:27:03 +02:00
committed by therealkrispet
parent f626fef8f8
commit 2e5867cc49
14 changed files with 42 additions and 19 deletions

View File

@ -1,6 +1,4 @@
import logging
from tfw.internals.networking import Scope
from tfw.internals.networking import Scope, Intent
from tfw.internals.inotify import InotifyObserver
from .supervisor import ProcessLogManager
@ -33,4 +31,4 @@ class LogInotifyObserver(InotifyObserver, ProcessLogManager):
'key': 'process.log.new',
'stdout': self.read_stdout(self.process_name, tail=self.log_tail),
'stderr': self.read_stderr(self.process_name, tail=self.log_tail)
}, Scope.BROADCAST)
}, Scope.BROADCAST, Intent.EVENT)

View File

@ -1,7 +1,7 @@
import logging
from xmlrpc.client import Fault as SupervisorFault
from tfw.internals.networking import Scope
from tfw.internals.networking import Scope, Intent
from .supervisor import ProcessManager
@ -26,7 +26,7 @@ class ProcessHandler(ProcessManager):
self.commands[message['key']](message['name'])
except SupervisorFault as fault:
message['error'] = fault.faultString
connector.send_message(message, scope=Scope.WEBSOCKET)
connector.send_message(message, scope=Scope.BROADCAST, intent=Intent.EVENT)
except KeyError:
if not message['key'].startswith('process.log'):
LOG.error('IGNORING MESSAGE: Invalid message received: %s', message)