get_bus() should return a default RedisBus() instance if the main bus is not registered

This commit is contained in:
Fabio Manganiello 2022-04-02 22:47:23 +02:00
parent b1491b8048
commit f7c594cc3f
Signed by: blacklight
GPG Key ID: D90FBA7F76362774
1 changed files with 5 additions and 2 deletions

View File

@ -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():