Fixes, readme
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user