Local builds: avoid 'Hub not initialized. Queueing on the side' warnings

We don't need messages at all for local builds, so use a separate "drop"
backend and reserve the "in_memory" backend for tests, where we sometimes
want to inspect the messages. This avoids a warning for each published
message.
This commit is contained in:
Owen W. Taylor
2020-10-29 10:23:44 -04:00
parent 192eefb641
commit 53d35e546d
3 changed files with 12 additions and 1 deletions

View File

@@ -75,7 +75,7 @@ class ProdConfiguration(BaseConfiguration):
class LocalBuildConfiguration(BaseConfiguration):
CACHE_DIR = "~/modulebuild/cache"
LOG_LEVEL = "debug"
MESSAGING = "in_memory"
MESSAGING = "drop"
ALLOW_CUSTOM_SCMURLS = True
RESOLVER = "mbs"

View File

@@ -95,6 +95,10 @@ def _in_memory_publish(topic, msg, conf, service):
_initial_messages.append(wrapped_msg)
def _drop_publish(topic, msg, conf, service):
""" Drop the message on the floor (used for local builds). """
known_fedmsg_services = ["buildsys", "mbs"]
@@ -110,6 +114,12 @@ _in_memory_backend = {
"services": [],
"topic_suffix": ".",
}
_drop_backend = {
"publish": _drop_publish,
"parser": FedmsgMessageParser(known_fedmsg_services), # re-used. :)
"services": [],
"topic_suffix": ".",
}
_messaging_backends = {}

View File

@@ -47,6 +47,7 @@ setup(
"mbs.messaging_backends": [
"fedmsg = module_build_service.common.messaging:_fedmsg_backend",
"in_memory = module_build_service.common.messaging:_in_memory_backend",
"drop = module_build_service.common.messaging:_drop_backend",
# 'custom = your_organization:_custom_backend',
],
"mbs.builder_backends": [