294bdf4577
Build docker and publish / build (20.15.1) (pull_request) Failing after 8m41s
- 将 OrderStatusClaimed 从 4 改为 6,消除与 OrderStatusFailed 的值冲突 - finalizeCouponAndOrder 改用直接 DB 更新(WHERE status=6→SET status=5), 绕过 UpdateOrderStatus 的 status<target 守卫,同时用 model.Update 刷新缓存 - releaseClaim 返回 error,调用处检查并记录日志;releaseClaim 失败由 stuck recovery 定时任务兜底 - claimAndGetOrder 对 status=claimed 返回可重试错误而非静默跳过; ProcessTask 区分 "stuck in claimed" 与 "非 paid 跳过" 两种场景 - 新增 StuckOrderRecoveryLogic:每 10 分钟扫描超时 claimed 订单, 重置 status=paid 并重新入队 ForthwithActivateOrder,确保不依赖 asynq 原始重试(可能已超 maxRetry) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: multica-agent <github@multica.ai>
55 lines
2.2 KiB
Go
55 lines
2.2 KiB
Go
package handler
|
|
|
|
import (
|
|
"github.com/hibiken/asynq"
|
|
"github.com/perfect-panel/server/internal/svc"
|
|
iapLogic "github.com/perfect-panel/server/queue/logic/iap"
|
|
orderLogic "github.com/perfect-panel/server/queue/logic/order"
|
|
smslogic "github.com/perfect-panel/server/queue/logic/sms"
|
|
"github.com/perfect-panel/server/queue/logic/subscription"
|
|
"github.com/perfect-panel/server/queue/logic/task"
|
|
"github.com/perfect-panel/server/queue/logic/traffic"
|
|
"github.com/perfect-panel/server/queue/types"
|
|
|
|
emailLogic "github.com/perfect-panel/server/queue/logic/email"
|
|
)
|
|
|
|
func RegisterHandlers(mux *asynq.ServeMux, serverCtx *svc.ServiceContext) {
|
|
// Send email task
|
|
mux.Handle(types.ForthwithSendEmail, emailLogic.NewSendEmailLogic(serverCtx))
|
|
// Send sms task
|
|
mux.Handle(types.ForthwithSendSms, smslogic.NewSendSmsLogic(serverCtx))
|
|
// Defer close order task
|
|
mux.Handle(types.DeferCloseOrder, orderLogic.NewDeferCloseOrderLogic(serverCtx))
|
|
// Forthwith activate order task
|
|
mux.Handle(types.ForthwithActivateOrder, orderLogic.NewActivateOrderLogic(serverCtx))
|
|
|
|
// Forthwith traffic statistics
|
|
mux.Handle(types.ForthwithTrafficStatistics, traffic.NewTrafficStatisticsLogic(serverCtx))
|
|
|
|
// Schedule check subscription
|
|
mux.Handle(types.SchedulerCheckSubscription, subscription.NewCheckSubscriptionLogic(serverCtx))
|
|
|
|
// Schedule total server data
|
|
mux.Handle(types.SchedulerTotalServerData, traffic.NewServerDataLogic(serverCtx))
|
|
|
|
// Schedule reset traffic
|
|
mux.Handle(types.SchedulerResetTraffic, traffic.NewResetTrafficLogic(serverCtx))
|
|
|
|
// ScheduledBatchSendEmail
|
|
mux.Handle(types.ScheduledBatchSendEmail, emailLogic.NewBatchEmailLogic(serverCtx))
|
|
|
|
// ScheduledTrafficStat
|
|
mux.Handle(types.SchedulerTrafficStat, traffic.NewStatLogic(serverCtx))
|
|
|
|
// ForthwithQuotaTask
|
|
mux.Handle(types.ForthwithQuotaTask, task.NewQuotaTaskLogic(serverCtx))
|
|
|
|
// Apple IAP 对账(第二层:5min 扫描 + 第三层:日终全量)
|
|
mux.Handle(types.SchedulerIAPReconcile, iapLogic.NewReconcileLogic(serverCtx))
|
|
mux.Handle(types.SchedulerIAPDailyReconcile, iapLogic.NewDailyReconcileLogic(serverCtx))
|
|
|
|
// Stuck order recovery
|
|
mux.Handle(types.SchedulerStuckOrderRecovery, orderLogic.NewStuckOrderRecoveryLogic(serverCtx))
|
|
}
|