MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / rebuild

Method rebuild

sdk/cliproxy/auth/auto_refresh_loop.go:93–120  ·  view source on GitHub ↗
(now time.Time)

Source from the content-addressed store, hash-verified

91}
92
93func (l *authAutoRefreshLoop) rebuild(now time.Time) {
94 type entry struct {
95 id string
96 next time.Time
97 }
98
99 entries := make([]entry, 0)
100
101 l.manager.mu.RLock()
102 for id, auth := range l.manager.auths {
103 next, ok := nextRefreshCheckAt(now, auth, l.interval)
104 if !ok {
105 continue
106 }
107 entries = append(entries, entry{id: id, next: next})
108 }
109 l.manager.mu.RUnlock()
110
111 l.mu.Lock()
112 l.queue = l.queue[:0]
113 l.index = make(map[string]*refreshHeapItem, len(entries))
114 for _, e := range entries {
115 item := &refreshHeapItem{id: e.id, next: e.next}
116 heap.Push(&l.queue, item)
117 l.index[e.id] = item
118 }
119 l.mu.Unlock()
120}
121
122func (l *authAutoRefreshLoop) loop(ctx context.Context) {
123 timer := time.NewTimer(time.Hour)

Callers

nothing calls this directly

Calls 2

nextRefreshCheckAtFunction · 0.85
PushMethod · 0.80

Tested by

no test coverage detected