refactor: 提取 service 层 best-effort 超时常量

- 新增 defaultBETimeout = 5 * time.Second
- 替换 auth/auth_runtime/password_reset/user_service/webhook 中 6 处硬编码 5*time.Second
This commit is contained in:
2026-05-08 12:44:05 +08:00
parent 9ad7b5c0df
commit 2ecd1fef1e
5 changed files with 8 additions and 7 deletions

View File

@@ -295,7 +295,7 @@ func (s *WebhookService) recordDelivery(task *deliveryTask, statusCode int, body
delivery.DeliveredAt = &now
}
// 使用带超时的独立 context防止 DB 写入无限等待
writeCtx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
writeCtx, cancel := context.WithTimeout(context.Background(), defaultBETimeout)
defer cancel()
_ = s.repo.CreateDelivery(writeCtx, delivery)
}