diff --git a/internal/biz/cron_notice.go b/internal/biz/cron_notice.go index 224c397..6279e86 100644 --- a/internal/biz/cron_notice.go +++ b/internal/biz/cron_notice.go @@ -54,6 +54,20 @@ func (v *VoucherBiz) timeSliceQuery(ctx context.Context, startTime, endTime time } eg.Go(func() error { + + select { + case <-ctx.Done(): + return ctx.Err() + default: + // 继续执行 + } + + defer func() { + if err := recover(); err != nil { + log.Errorf("查询券订单状态发生错误:req:%+v,err:%v", err) + } + }() + return v.ExecuteNotice(ctx, req) }) } @@ -70,7 +84,7 @@ func (v *VoucherBiz) ExecuteNotice(ctx context.Context, req *bo.FindInBatchesUse for _, order := range rows { if err := v.notice(ctx, order); err != nil { - log.Errorf("招行查询券订单状态发生错误,orderNo:%s,err:%v", order.OrderNo, err) + log.Errorf("查询券订单状态发生错误,orderNo:%s,err:%v", order.OrderNo, err) } }