优化3
This commit is contained in:
@@ -311,6 +311,18 @@ async def trade(
|
||||
)
|
||||
|
||||
if not trade_data:
|
||||
# 去重:同一 trade_code 在 3600s 内不重复下发
|
||||
dedup_key = f"jp_surugaya_trade_pending:{trade_code}"
|
||||
dedup_exists = await container.session_store._redis.get(dedup_key)
|
||||
if not dedup_exists:
|
||||
await container.session_store._redis.setex(dedup_key, 3600, "1")
|
||||
await container.session_store._redis.xadd(
|
||||
name="jp_surugaya_trade_fetch",
|
||||
fields={"payload": json.dumps({"trade_code": trade_code})},
|
||||
maxlen=100,
|
||||
approximate=True,
|
||||
)
|
||||
|
||||
return ApiResponse[dict[str, Any]](
|
||||
success=False,
|
||||
msg="未找到该交易",
|
||||
|
||||
Reference in New Issue
Block a user