From 9c25a131fa25b6db8482d8ede0f80b8ba10e0448 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sat, 2 Apr 2022 22:47:23 +0200 Subject: [PATCH] get_bus() should return a default RedisBus() instance if the main bus is not registered --- platypush/context/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/platypush/context/__init__.py b/platypush/context/__init__.py index 43f764d73..bcadf289a 100644 --- a/platypush/context/__init__.py +++ b/platypush/context/__init__.py @@ -133,8 +133,11 @@ def get_plugin(plugin_name, reload=False): def get_bus() -> Bus: global main_bus - assert main_bus, 'The bus is not registered' - return main_bus + if main_bus: + return main_bus + + from platypush.bus.redis import RedisBus + return RedisBus() def get_or_create_event_loop():