fix: 修复订阅更新 group_locked 不能为 null 问题 + Kutt 短链3次重试
All checks were successful
Build docker and publish / build (20.15.1) (push) Successful in 7m46s
All checks were successful
Build docker and publish / build (20.15.1) (push) Successful in 7m46s
- updateUserSubscribeLogic: 更新订阅时补充 GroupLocked 字段,避免写入 NULL 触发数据库约束错误 - inviteLinkResolver: generateShortLinkWithTimeout 增加最多3次重试,防止网络波动导致短链生成失败 Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
parent
b43dcd8dab
commit
d63b943964
@ -54,6 +54,7 @@ func (l *UpdateUserSubscribeLogic) UpdateUserSubscribe(req *types.UpdateUserSubs
|
||||
UUID: userSub.UUID,
|
||||
Status: userSub.Status,
|
||||
NodeGroupId: userSub.NodeGroupId,
|
||||
GroupLocked: userSub.GroupLocked,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
|
||||
@ -215,18 +215,26 @@ func (r *InviteLinkResolver) generateShortLinkWithTimeout(referCode string, time
|
||||
}
|
||||
_, domain := r.resolveShareURLAndDomain()
|
||||
|
||||
requestCtx := r.ctx
|
||||
var cancel context.CancelFunc
|
||||
if timeout > 0 {
|
||||
requestCtx, cancel = context.WithTimeout(r.ctx, timeout)
|
||||
defer cancel()
|
||||
const maxRetries = 3
|
||||
var lastErr error
|
||||
for attempt := 0; attempt < maxRetries; attempt++ {
|
||||
requestCtx := r.ctx
|
||||
var cancel context.CancelFunc
|
||||
if timeout > 0 {
|
||||
requestCtx, cancel = context.WithTimeout(r.ctx, timeout)
|
||||
}
|
||||
|
||||
shortLink, err := r.createShortLink(requestCtx, longLink, domain)
|
||||
if cancel != nil {
|
||||
cancel()
|
||||
}
|
||||
if err == nil && strings.TrimSpace(shortLink) != "" {
|
||||
return strings.TrimSpace(shortLink), nil
|
||||
}
|
||||
lastErr = err
|
||||
}
|
||||
|
||||
shortLink, err := r.createShortLink(requestCtx, longLink, domain)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return strings.TrimSpace(shortLink), nil
|
||||
return "", lastErr
|
||||
}
|
||||
|
||||
func (r *InviteLinkResolver) getCachedShortLink(referCode string) string {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user