From 75f5d79a75827fcc52d34f868d47f844c9850818 Mon Sep 17 00:00:00 2001 From: simon987 Date: Sun, 20 Dec 2020 19:58:31 -0500 Subject: [PATCH] Use sets instead of keys in state --- run.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/run.py b/run.py index edf7f85..5047cf1 100644 --- a/run.py +++ b/run.py @@ -8,7 +8,7 @@ from queue import Queue from threading import Thread import redis -from hexlib.db import VolatileState +from hexlib.db import VolatileBooleanState from hexlib.monitoring import Monitoring from chan.chan import CHANS @@ -28,9 +28,7 @@ REDIS_HOST = os.environ.get("CF_REDIS_HOST", "localhost") REDIS_PORT = os.environ.get("CF_REDIS_PORT", 6379) CHAN = os.environ.get("CF_CHAN", None) -ARC_LISTS = os.environ.get("CF_ARC_LISTS", "arc,imhash").split(",") - -PUB_CHANNEL = os.environ.get("CF_PUB_CHANNEL", "chan_feed") +ARC_LISTS = os.environ.get("CF_ARC_LISTS", "arc").split(",") class ChanScanner: @@ -84,11 +82,11 @@ def once(func): class ChanState: def __init__(self, prefix): - self._state = VolatileState(prefix, 86400 * 7, host=REDIS_HOST, port=REDIS_PORT) + self._state = VolatileBooleanState(prefix, host=REDIS_HOST, port=REDIS_PORT) print("redis host=" + REDIS_HOST) def mark_visited(self, item: int): - self._state["posts"][item] = 1 + self._state["posts"][item] = True def has_visited(self, item: int): return self._state["posts"][item] is not None