From 16b031555fcee5213b542428dc799eb850e31bfb Mon Sep 17 00:00:00 2001 From: Devoalda Date: Wed, 1 Nov 2023 09:56:47 +0800 Subject: [PATCH] test Trash Collector --- .../utils/TrashCollector/TrashCollector.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/safeshare/safeshare_app/utils/TrashCollector/TrashCollector.py b/safeshare/safeshare_app/utils/TrashCollector/TrashCollector.py index 0e09c23..7ce2d1f 100644 --- a/safeshare/safeshare_app/utils/TrashCollector/TrashCollector.py +++ b/safeshare/safeshare_app/utils/TrashCollector/TrashCollector.py @@ -1,7 +1,8 @@ import os import threading import logging -import redis +# import redis +from rediscluster import RedisCluster from django.conf import settings @@ -14,10 +15,10 @@ class TrashCollector: self.media_root = settings.MEDIA_ROOT # Connect to Redis - self.redis = redis.StrictRedis( - host=settings.REDIS_HOST, - port=settings.REDIS_PORT, - db=settings.REDIS_DB, + startup_nodes = [{"host": settings.REDIS_HOST, "port": settings.REDIS_PORT}] + self.redis = RedisCluster( + startup_nodes=startup_nodes, + decode_responses=True, ) def start(self):