diff --git a/.gitignore b/.gitignore index 9595be5..c8ece8c 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ dist # Created by unit tests .pytest_cache/ +/.gtm/ diff --git a/CHANGELOG.md b/CHANGELOG.md index 0435f66..c7364f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,33 +1,74 @@ # Changelog -## [0.0.3](https://github.com/OpenVoiceOS/ovos-messagebus/tree/0.0.3) (2023-05-24) +## [V0.0.4a8](https://github.com/OpenVoiceOS/ovos-messagebus/tree/V0.0.4a8) (2023-12-30) -[Full Changelog](https://github.com/OpenVoiceOS/ovos-messagebus/compare/V0.0.3a2...0.0.3) +[Full Changelog](https://github.com/OpenVoiceOS/ovos-messagebus/compare/V0.0.4a7...V0.0.4a8) + +**Fixed bugs:** + +- fix/log\_spam [\#22](https://github.com/OpenVoiceOS/ovos-messagebus/pull/22) ([JarbasAl](https://github.com/JarbasAl)) + +## [V0.0.4a7](https://github.com/OpenVoiceOS/ovos-messagebus/tree/V0.0.4a7) (2023-12-29) + +[Full Changelog](https://github.com/OpenVoiceOS/ovos-messagebus/compare/V0.0.4a6...V0.0.4a7) **Merged pull requests:** -- Replace docker container actions [\#10](https://github.com/OpenVoiceOS/ovos-messagebus/pull/10) ([NeonDaniel](https://github.com/NeonDaniel)) +- packaging/update\_imports [\#21](https://github.com/OpenVoiceOS/ovos-messagebus/pull/21) ([JarbasAl](https://github.com/JarbasAl)) + +## [V0.0.4a6](https://github.com/OpenVoiceOS/ovos-messagebus/tree/V0.0.4a6) (2023-12-29) + +[Full Changelog](https://github.com/OpenVoiceOS/ovos-messagebus/compare/V0.0.4a5...V0.0.4a6) -## [V0.0.3a2](https://github.com/OpenVoiceOS/ovos-messagebus/tree/V0.0.3a2) (2023-05-24) +**Closed issues:** + +- This happens when I ctrl+c a skill launched by ovos-skill-launcher [\#14](https://github.com/OpenVoiceOS/ovos-messagebus/issues/14) + +**Merged pull requests:** -[Full Changelog](https://github.com/OpenVoiceOS/ovos-messagebus/compare/V0.0.3a1...V0.0.3a2) +- Update requirements.txt [\#20](https://github.com/OpenVoiceOS/ovos-messagebus/pull/20) ([JarbasAl](https://github.com/JarbasAl)) + +## [V0.0.4a5](https://github.com/OpenVoiceOS/ovos-messagebus/tree/V0.0.4a5) (2023-10-17) + +[Full Changelog](https://github.com/OpenVoiceOS/ovos-messagebus/compare/V0.0.4a4...V0.0.4a5) **Fixed bugs:** -- Killed if previous bus.pid exists [\#4](https://github.com/OpenVoiceOS/ovos-messagebus/issues/4) +- log tweaks [\#19](https://github.com/OpenVoiceOS/ovos-messagebus/pull/19) ([JarbasAl](https://github.com/JarbasAl)) -**Closed issues:** +## [V0.0.4a4](https://github.com/OpenVoiceOS/ovos-messagebus/tree/V0.0.4a4) (2023-09-28) -- Error when running [\#7](https://github.com/OpenVoiceOS/ovos-messagebus/issues/7) +[Full Changelog](https://github.com/OpenVoiceOS/ovos-messagebus/compare/V0.0.4a3...V0.0.4a4) **Merged pull requests:** -- Update GitHub automation [\#9](https://github.com/OpenVoiceOS/ovos-messagebus/pull/9) ([NeonDaniel](https://github.com/NeonDaniel)) -- Update dependencies to stable versions [\#8](https://github.com/OpenVoiceOS/ovos-messagebus/pull/8) ([NeonDaniel](https://github.com/NeonDaniel)) +- \[requirements\] Add missing ovos-bus-client [\#18](https://github.com/OpenVoiceOS/ovos-messagebus/pull/18) ([goldyfruit](https://github.com/goldyfruit)) -## [V0.0.3a1](https://github.com/OpenVoiceOS/ovos-messagebus/tree/V0.0.3a1) (2023-04-30) +## [V0.0.4a3](https://github.com/OpenVoiceOS/ovos-messagebus/tree/V0.0.4a3) (2023-09-27) -[Full Changelog](https://github.com/OpenVoiceOS/ovos-messagebus/compare/V0.0.2...V0.0.3a1) +[Full Changelog](https://github.com/OpenVoiceOS/ovos-messagebus/compare/V0.0.4a2...V0.0.4a3) + +## [V0.0.4a2](https://github.com/OpenVoiceOS/ovos-messagebus/tree/V0.0.4a2) (2023-08-16) + +[Full Changelog](https://github.com/OpenVoiceOS/ovos-messagebus/compare/V0.0.4a1...V0.0.4a2) + +**Closed issues:** + +- Consider making this configurable with a default value. maybe `Configuration["logs"]["excluded_messages"]`? [\#16](https://github.com/OpenVoiceOS/ovos-messagebus/issues/16) + +## [V0.0.4a1](https://github.com/OpenVoiceOS/ovos-messagebus/tree/V0.0.4a1) (2023-06-23) + +[Full Changelog](https://github.com/OpenVoiceOS/ovos-messagebus/compare/V0.0.3...V0.0.4a1) + +**Fixed bugs:** + +- AttributeError: 'MemoryTempfile' object has no attribute 'tempdir' [\#12](https://github.com/OpenVoiceOS/ovos-messagebus/issues/12) +- Killed if previous bus.pid exists [\#4](https://github.com/OpenVoiceOS/ovos-messagebus/issues/4) + +**Merged pull requests:** + +- Remove PIDLock to fix \#4 [\#13](https://github.com/OpenVoiceOS/ovos-messagebus/pull/13) ([goldyfruit](https://github.com/goldyfruit)) +- Replace docker container actions [\#10](https://github.com/OpenVoiceOS/ovos-messagebus/pull/10) ([NeonDaniel](https://github.com/NeonDaniel)) diff --git a/ovos_messagebus/__main__.py b/ovos_messagebus/__main__.py index 978f527..c1a58c4 100644 --- a/ovos_messagebus/__main__.py +++ b/ovos_messagebus/__main__.py @@ -22,7 +22,7 @@ from ovos_utils import create_daemon, wait_for_exit_signal from ovos_messagebus.load_config import load_message_bus_config from ovos_utils.log import LOG, init_service_logger -from ovos_utils.process_utils import reset_sigint_handler, PIDLock +from ovos_utils.process_utils import reset_sigint_handler from tornado import web, ioloop from ovos_messagebus.event_handler import MessageBusEventHandler @@ -41,10 +41,8 @@ def on_stopping(): def main(ready_hook=on_ready, error_hook=on_error, stopping_hook=on_stopping): - PIDLock.init() reset_sigint_handler() init_service_logger("bus") - PIDLock("bus") LOG.info('Starting message bus service...') config = load_message_bus_config() routes = [(config.route, MessageBusEventHandler)] diff --git a/ovos_messagebus/event_handler.py b/ovos_messagebus/event_handler.py index ac028e4..e54824d 100644 --- a/ovos_messagebus/event_handler.py +++ b/ovos_messagebus/event_handler.py @@ -17,10 +17,12 @@ import sys import traceback -from ovos_utils.messagebus import FakeMessage as Message +from ovos_utils.fakebus import Message from ovos_utils.log import LOG +from ovos_config import Configuration from pyee import EventEmitter from tornado.websocket import WebSocketHandler +from ovos_bus_client.session import SessionManager client_connections = [] @@ -33,13 +35,24 @@ def __init__(self, application, request, **kwargs): def on(self, event_name, handler): self.emitter.on(event_name, handler) + @property + def max_message_size(self) -> int: + return Configuration().get("websocket", {}).get("max_msg_size", 10) * 1024 * 1024 + def on_message(self, message): - LOG.debug(message) + try: deserialized_message = Message.deserialize(message) except Exception: return + filter_ogs = ["gui.status.request", "gui.page.upload"] + if deserialized_message.msg_type not in filter_ogs: + LOG.debug(deserialized_message.msg_type + + f' source: {deserialized_message.context.get("source", [])}' + + f' destination: {deserialized_message.context.get("destination", [])}\n' + f'SESSION: {SessionManager.get(deserialized_message).serialize()}') + try: self.emitter.emit(deserialized_message.msg_type, deserialized_message) @@ -52,7 +65,8 @@ def on_message(self, message): client.write_message(message) def open(self): - self.write_message(Message("connected").serialize()) + self.write_message(Message("connected", + context={"session": {"session_id": "default"}}).serialize()) client_connections.append(self) def on_close(self): diff --git a/ovos_messagebus/version.py b/ovos_messagebus/version.py index 23532c1..b5fb52b 100644 --- a/ovos_messagebus/version.py +++ b/ovos_messagebus/version.py @@ -1,6 +1,6 @@ # START_VERSION_BLOCK VERSION_MAJOR = 0 VERSION_MINOR = 0 -VERSION_BUILD = 3 +VERSION_BUILD = 4 VERSION_ALPHA = 0 # END_VERSION_BLOCK diff --git a/requirements.txt b/requirements.txt index e94c8a7..7eb56c9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ tornado~=6.0, >=6.0.3 -ovos-utils~=0.0, >=0.0.32 -ovos-config~=0.0,>=0.0.8 \ No newline at end of file +ovos-bus-client~=0.0, >=0.0.7 +ovos-utils~=0.0, >=0.0.37 +ovos-config~=0.0,>=0.0.12