mirror of
https://github.com/simon987/chan_feed.git
synced 2025-04-04 08:23:05 +00:00
Use sets instead of keys in state
This commit is contained in:
parent
604548bd58
commit
75f5d79a75
10
run.py
10
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user