Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
b5642bd0
Unverified
Commit
b5642bd0
authored
Mar 30, 2026
by
Wesley Liddick
Committed by
GitHub
Mar 30, 2026
Browse files
Merge pull request #1377 from DaydreamCoding/fix/lifecycle-stop-duplicate-close
fix(lifecycle): TokenRefreshService Stop() 防重复 close
parents
128f3222
61607990
Changes
1
Hide whitespace changes
Inline
Side-by-side
backend/internal/service/token_refresh_service.go
View file @
b5642bd0
...
...
@@ -32,8 +32,9 @@ type TokenRefreshService struct {
privacyClientFactory
PrivacyClientFactory
proxyRepo
ProxyRepository
stopCh
chan
struct
{}
wg
sync
.
WaitGroup
stopCh
chan
struct
{}
stopOnce
sync
.
Once
wg
sync
.
WaitGroup
}
// NewTokenRefreshService 创建token刷新服务
...
...
@@ -130,7 +131,9 @@ func (s *TokenRefreshService) Start() {
// Stop 停止刷新服务(可安全多次调用)
func
(
s
*
TokenRefreshService
)
Stop
()
{
close
(
s
.
stopCh
)
s
.
stopOnce
.
Do
(
func
()
{
close
(
s
.
stopCh
)
})
s
.
wg
.
Wait
()
slog
.
Info
(
"token_refresh.service_stopped"
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment