Fix set_graph on non-existing edge (#6777)

### What problem does this PR solve?

Fix set_graph on non-existing edge

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Zhichang Yu
2025-04-03 11:09:04 +08:00
committed by GitHub
parent 5b5558300a
commit fdc410e743
3 changed files with 19 additions and 7 deletions

View File

@ -22,6 +22,7 @@ import valkey as redis
from rag import settings
from rag.utils import singleton
from valkey.lock import Lock
import trio
class RedisMsg:
def __init__(self, consumer, queue_name, group_name, msg_id, message):
@ -317,5 +318,12 @@ class RedisDistributedLock:
REDIS_CONN.delete_if_equal(self.lock_key, self.lock_value)
return self.lock.acquire(token=self.lock_value)
async def spin_acquire(self):
REDIS_CONN.delete_if_equal(self.lock_key, self.lock_value)
while True:
if self.lock.acquire(token=self.lock_value):
break
await trio.sleep(10)
def release(self):
REDIS_CONN.delete_if_equal(self.lock_key, self.lock_value)