fix(redis): Redis Cluster eval errors by adding hash tags to trigger debug keys (#31701)

This commit is contained in:
Jax 2026-01-30 16:05:02 +08:00 committed by GitHub
parent d6a787497f
commit 95d68437d1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 7 deletions

View File

@ -23,8 +23,8 @@ class TriggerDebugEventBus:
""" """
# LUA_SELECT: Atomic poll or register for event # LUA_SELECT: Atomic poll or register for event
# KEYS[1] = trigger_debug_inbox:{tenant_id}:{address_id} # KEYS[1] = trigger_debug_inbox:{<tenant_id>}:<address_id>
# KEYS[2] = trigger_debug_waiting_pool:{tenant_id}:... # KEYS[2] = trigger_debug_waiting_pool:{<tenant_id>}:...
# ARGV[1] = address_id # ARGV[1] = address_id
LUA_SELECT = ( LUA_SELECT = (
"local v=redis.call('GET',KEYS[1]);" "local v=redis.call('GET',KEYS[1]);"
@ -35,7 +35,7 @@ class TriggerDebugEventBus:
) )
# LUA_DISPATCH: Dispatch event to all waiting addresses # LUA_DISPATCH: Dispatch event to all waiting addresses
# KEYS[1] = trigger_debug_waiting_pool:{tenant_id}:... # KEYS[1] = trigger_debug_waiting_pool:{<tenant_id>}:...
# ARGV[1] = tenant_id # ARGV[1] = tenant_id
# ARGV[2] = event_json # ARGV[2] = event_json
LUA_DISPATCH = ( LUA_DISPATCH = (
@ -43,7 +43,7 @@ class TriggerDebugEventBus:
"if #a==0 then return 0 end;" "if #a==0 then return 0 end;"
"redis.call('DEL',KEYS[1]);" "redis.call('DEL',KEYS[1]);"
"for i=1,#a do " "for i=1,#a do "
f"redis.call('SET','trigger_debug_inbox:'..ARGV[1]..':'..a[i],ARGV[2],'EX',{TRIGGER_DEBUG_EVENT_TTL});" f"redis.call('SET','trigger_debug_inbox:{{'..ARGV[1]..'}}'..':'..a[i],ARGV[2],'EX',{TRIGGER_DEBUG_EVENT_TTL});"
"end;" "end;"
"return #a" "return #a"
) )
@ -108,7 +108,7 @@ class TriggerDebugEventBus:
Event object if available, None otherwise Event object if available, None otherwise
""" """
address_id: str = hashlib.sha256(f"{user_id}|{app_id}|{node_id}".encode()).hexdigest() address_id: str = hashlib.sha256(f"{user_id}|{app_id}|{node_id}".encode()).hexdigest()
address: str = f"trigger_debug_inbox:{tenant_id}:{address_id}" address: str = f"trigger_debug_inbox:{{{tenant_id}}}:{address_id}"
try: try:
event_data = redis_client.eval( event_data = redis_client.eval(

View File

@ -42,7 +42,7 @@ def build_webhook_pool_key(tenant_id: str, app_id: str, node_id: str) -> str:
app_id: App ID app_id: App ID
node_id: Node ID node_id: Node ID
""" """
return f"{TriggerDebugPoolKey.WEBHOOK}:{tenant_id}:{app_id}:{node_id}" return f"{TriggerDebugPoolKey.WEBHOOK}:{{{tenant_id}}}:{app_id}:{node_id}"
class PluginTriggerDebugEvent(BaseDebugEvent): class PluginTriggerDebugEvent(BaseDebugEvent):
@ -64,4 +64,4 @@ def build_plugin_pool_key(tenant_id: str, provider_id: str, subscription_id: str
provider_id: Provider ID provider_id: Provider ID
subscription_id: Subscription ID subscription_id: Subscription ID
""" """
return f"{TriggerDebugPoolKey.PLUGIN}:{tenant_id}:{str(provider_id)}:{subscription_id}:{name}" return f"{TriggerDebugPoolKey.PLUGIN}:{{{tenant_id}}}:{str(provider_id)}:{subscription_id}:{name}"