From f7c594cc3f42c4bfa044150363d8f47b9afbc05c Mon Sep 17 00:00:00 2001
From: Fabio Manganiello <info@fabiomanganiello.com>
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():