diff --git a/docker-compose.yaml b/docker-compose.yaml index b832205..d47b5b7 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -41,15 +41,3 @@ services: - redis ports: - '8035:8001' - - redisstreamer-record: - build: . - container_name: redisstreamer-record - command: -m redis_streamer.agents.record - volumes: - - ./redis_streamer:/src/redis_streamer - environment: - REDIS_URL: redis://redis:6379 - depends_on: - - redis - restart: unless-stopped \ No newline at end of file diff --git a/redis_streamer/cli.py b/tests/api.py similarity index 100% rename from redis_streamer/cli.py rename to tests/api.py diff --git a/tests/monitor.py b/tests/monitor.py index 89f1080..23337da 100644 --- a/tests/monitor.py +++ b/tests/monitor.py @@ -1,63 +1,7 @@ -import redis - -class Monitor: - def __init__(self, connection_pool): - self.connection_pool = connection_pool - self.connection = None - - def __del__(self): - try: - self.reset() - except: - pass - - def reset(self): - if self.connection: - self.connection_pool.release(self.connection) - self.connection = None - - def monitor(self): - if self.connection is None: - self.connection = self.connection_pool.get_connection( - 'monitor', None) - self.connection.send_command("monitor") - return self.listen() - - def parse_response(self): - msg = self.connection.read_response() - return - - def listen(self): - while True: - yield self.parse_response() - - - - - -class Monitor: - def __init__(self, r): - self.r = r - - def run(self): - STATE = "waiting" - with r.monitor() as m: - for command in m.listen(): - if STATE == "waiting": - pass - if STATE == "waiting": - pass - +import redis if __name__ == '__main__': - pool = redis.ConnectionPool(host='localhost', port=6379, db=0) - # monitor = Monitor(pool) - # commands = monitor.monitor() - - # for c in commands: - # print(c) - r = redis.Redis(host='localhost', port=6379, db=0) with r.monitor() as m: for command in m.listen(): - print({k: v[:50] if isinstance(v, (str, bytes)) else v for k, v in command.items()}) + print({k: v[:50] if isinstance(v, (str, bytes)) else v for k, v in command.items()}) \ No newline at end of file