chore: format

This commit is contained in:
Timothy Jaeryang Baek
2025-03-28 11:47:14 -07:00
parent b8c1bb0ec5
commit 1ac87c55ff
6 changed files with 432 additions and 244 deletions

View File

@@ -2,13 +2,16 @@ import json
import uuid
from open_webui.utils.redis import get_redis_connection
class RedisLock:
def __init__(self, redis_url, lock_name, timeout_secs, redis_sentinels=[]):
self.lock_name = lock_name
self.lock_id = str(uuid.uuid4())
self.timeout_secs = timeout_secs
self.lock_obtained = False
self.redis = get_redis_connection(redis_url, redis_sentinels, decode_responses=True)
self.redis = get_redis_connection(
redis_url, redis_sentinels, decode_responses=True
)
def aquire_lock(self):
# nx=True will only set this key if it _hasn't_ already been set
@@ -32,7 +35,9 @@ class RedisLock:
class RedisDict:
def __init__(self, name, redis_url, redis_sentinels=[]):
self.name = name
self.redis = get_redis_connection(redis_url, redis_sentinels, decode_responses=True)
self.redis = get_redis_connection(
redis_url, redis_sentinels, decode_responses=True
)
def __setitem__(self, key, value):
serialized_value = json.dumps(value)