(manager *Manager, interval time.Duration, concurrency int)
| 25 | } |
| 26 | |
| 27 | func newAuthAutoRefreshLoop(manager *Manager, interval time.Duration, concurrency int) *authAutoRefreshLoop { |
| 28 | if interval <= 0 { |
| 29 | interval = refreshCheckInterval |
| 30 | } |
| 31 | if concurrency <= 0 { |
| 32 | concurrency = refreshMaxConcurrency |
| 33 | } |
| 34 | jobBuffer := concurrency * 4 |
| 35 | if jobBuffer < 64 { |
| 36 | jobBuffer = 64 |
| 37 | } |
| 38 | return &authAutoRefreshLoop{ |
| 39 | manager: manager, |
| 40 | interval: interval, |
| 41 | concurrency: concurrency, |
| 42 | index: make(map[string]*refreshHeapItem), |
| 43 | dirty: make(map[string]struct{}), |
| 44 | wakeCh: make(chan struct{}, 1), |
| 45 | jobs: make(chan string, jobBuffer), |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | func (l *authAutoRefreshLoop) queueReschedule(authID string) { |
| 50 | if l == nil || authID == "" { |
no outgoing calls