Fixes, readme

This commit is contained in:
Alexander
2026-04-09 23:06:17 +02:00
parent 909c8b1894
commit f22765d8f0
5 changed files with 170 additions and 23 deletions
+8 -3
View File
@@ -215,11 +215,16 @@ func (t *utlsRefreshTransport) RoundTrip(req *http.Request) (*http.Response, err
}
// StartBackgroundRefresh runs a goroutine that checks and refreshes tokens periodically.
func StartBackgroundRefresh(pool *Pool) {
func StartBackgroundRefresh(ctx context.Context, pool *Pool) {
go func() {
for {
time.Sleep(refreshInterval)
refreshAll(pool)
select {
case <-ctx.Done():
log.Printf("background refresh stopped")
return
case <-time.After(refreshInterval):
refreshAll(pool)
}
}
}()
}