auto-sync: 2026-06-09 07:46:23
This commit is contained in:
@@ -489,6 +489,13 @@ async def gitea_webhook(
|
||||
logger.warning("Failed to parse webhook payload")
|
||||
return Response(status_code=200, content="invalid payload")
|
||||
|
||||
# 2. 幂等检查(需要在 payload 解析后,以支持内容去重)
|
||||
if x_gitea_event and x_gitea_delivery:
|
||||
async with _idempotency_lock:
|
||||
if _is_duplicate(x_gitea_event, x_gitea_delivery, payload):
|
||||
logger.debug("Duplicate webhook: %s/%s", x_gitea_event, x_gitea_delivery)
|
||||
return Response(status_code=200, content="duplicate")
|
||||
|
||||
# 4. 查找 handler
|
||||
handler = _EVENT_HANDLERS.get(x_gitea_event or "")
|
||||
if not handler:
|
||||
|
||||
Reference in New Issue
Block a user