mirror of
https://github.com/open-webui/open-webui.git
synced 2026-04-30 09:18:50 -05:00
refac
This commit is contained in:
@@ -73,7 +73,13 @@ async def redis_list_item_tasks(redis: Redis, item_id: str) -> List[str]:
|
|||||||
|
|
||||||
|
|
||||||
async def redis_send_command(redis: Redis, command: dict):
|
async def redis_send_command(redis: Redis, command: dict):
|
||||||
await redis.publish(REDIS_PUBSUB_CHANNEL, json.dumps(command))
|
command_json = json.dumps(command)
|
||||||
|
# RedisCluster doesn't expose publish() directly, but the
|
||||||
|
# PUBLISH command broadcasts across all cluster nodes server-side.
|
||||||
|
if hasattr(redis, "nodes_manager"):
|
||||||
|
await redis.execute_command("PUBLISH", REDIS_PUBSUB_CHANNEL, command_json)
|
||||||
|
else:
|
||||||
|
await redis.publish(REDIS_PUBSUB_CHANNEL, command_json)
|
||||||
|
|
||||||
|
|
||||||
async def cleanup_task(redis, task_id: str, id=None):
|
async def cleanup_task(redis, task_id: str, id=None):
|
||||||
|
|||||||
Reference in New Issue
Block a user