request.WithTimeout

This commit is contained in:
ziming 2025-05-06 14:14:16 +08:00
parent da92e535bb
commit 2fa0d7f62e
2 changed files with 3 additions and 1 deletions

View File

@ -39,7 +39,7 @@ var CacheKeyMap = map[CacheKey]time.Duration{
OrderConsumeFailAlarmKey: 2 * time.Hour, // 2小时 OrderConsumeFailAlarmKey: 2 * time.Hour, // 2小时
OrderConsumeFailAlarmLockKey: 60 * time.Second, OrderConsumeFailAlarmLockKey: 60 * time.Second,
NotifyRetryConsume: 60 * time.Second, NotifyRetryConsume: 60 * time.Second,
WechatNotifyRegisterTagCacheKey: 30 * 86400 * time.Second, // 5 WechatNotifyRegisterTagCacheKey: 30 * 86400 * time.Second, // 30
WechatNotifyRegisterTagCacheLockKey: 60 * time.Second, WechatNotifyRegisterTagCacheLockKey: 60 * time.Second,
WechatNotifyConsumeLockKey: 30 * time.Second, WechatNotifyConsumeLockKey: 30 * time.Second,

View File

@ -9,6 +9,7 @@ import (
"github.com/wechatpay-apiv3/wechatpay-go/services/cashcoupons" "github.com/wechatpay-apiv3/wechatpay-go/services/cashcoupons"
"io" "io"
"net/http" "net/http"
"time"
err2 "voucher/api/err" err2 "voucher/api/err"
"voucher/internal/biz/bo" "voucher/internal/biz/bo"
"voucher/internal/biz/vo" "voucher/internal/biz/vo"
@ -218,6 +219,7 @@ func (c *CpnRepoImpl) RegisterNotifyTag(ctx context.Context, stockID string) err
body, body,
request.WithHeaders(h), request.WithHeaders(h),
request.WithStatusCodeFunc(isSuccess), request.WithStatusCodeFunc(isSuccess),
request.WithTimeout(time.Second*20),
) )
if err != nil { if err != nil {
return err return err