收口审计治理与套餐任务进展

Constraint: 在线热修前必须保存当前迭代分支全部有效代码进展
Confidence: medium
Scope-risk: broad
Directive: 后续修改需保持审计事件与业务事务边界一致
Tested: git diff --cached --check
Not-tested: 未运行全量测试,提交用于切换分支前保存既有工作
This commit is contained in:
2026-08-05 14:30:54 +08:00
parent b3499adfca
commit 5e552d99bc
178 changed files with 16797 additions and 5674 deletions

View File

@@ -7,6 +7,8 @@ import (
"go.uber.org/zap"
notificationinfra "github.com/break/junhong_cmp_fiber/internal/infrastructure/notification"
"github.com/break/junhong_cmp_fiber/pkg/auditcontext"
"github.com/break/junhong_cmp_fiber/pkg/constants"
)
// NotificationCleanupHandler 处理低峰通知保留清理任务。
@@ -22,6 +24,10 @@ func NewNotificationCleanupHandler(service *notificationinfra.CleanupService, lo
// Handle 执行有界、可重入的通知分批清理。
func (h *NotificationCleanupHandler) Handle(ctx context.Context, _ *asynq.Task) error {
ctx = auditcontext.With(ctx, auditcontext.Context{
ActorKind: constants.AuditActorSystemTask, ActorID: constants.TaskTypeNotificationCleanup,
ActorName: "站内通知清理任务", Source: constants.AuditSourceWorker,
})
h.logger.Info("开始执行站内通知保留清理")
if err := h.service.Run(ctx); err != nil {
h.logger.Error("站内通知保留清理失败", zap.String("failure_category", "database"), zap.Error(err))