From 3ed382ec13f6f21a6a9dc7da68f4efe251c88a99 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Sun, 18 Sep 2022 13:01:19 +0100 Subject: [PATCH] Implement restricted sources --- db.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/db.py b/db.py index 473a2c0..1deb398 100644 --- a/db.py +++ b/db.py @@ -32,6 +32,12 @@ TYPES_MAIN = [ "topic", "update", ] +MAIN_SRC_MAP = { + "dis": "main", + "irc": "restricted", + "4ch": "main", +} + TYPES_META = ["who"] TYPES_INT = ["conn", "highlight", "znc", "query", "self"] KEYPREFIX = "queue." @@ -44,7 +50,8 @@ async def store_kafka_batch(data): batch = producer.create_batch() for msg in data: if msg["type"] in TYPES_MAIN: - index = "main" + #index = "main" + index = MAIN_SRC_MAP[msg["src"]] # schema = mc_s.schema_main elif msg["type"] in TYPES_META: index = "meta"