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

Method dispatchAuthUpdates

internal/watcher/dispatcher.go:197–221  ·  view source on GitHub ↗
(updates []AuthUpdate)

Source from the content-addressed store, hash-verified

195}
196
197func (w *Watcher) dispatchAuthUpdates(updates []AuthUpdate) {
198 if len(updates) == 0 {
199 return
200 }
201 queue := w.getAuthQueue()
202 if queue == nil {
203 return
204 }
205 baseTS := time.Now().UnixNano()
206 w.dispatchMu.Lock()
207 if w.pendingUpdates == nil {
208 w.pendingUpdates = make(map[string]AuthUpdate)
209 }
210 for idx, update := range updates {
211 key := w.authUpdateKey(update, baseTS+int64(idx))
212 if _, exists := w.pendingUpdates[key]; !exists {
213 w.pendingOrder = append(w.pendingOrder, key)
214 }
215 w.pendingUpdates[key] = update
216 }
217 if w.dispatchCond != nil {
218 w.dispatchCond.Signal()
219 }
220 w.dispatchMu.Unlock()
221}
222
223func (w *Watcher) authUpdateKey(update AuthUpdate, ts int64) string {
224 if update.ID != "" {

Calls 2

getAuthQueueMethod · 0.95
authUpdateKeyMethod · 0.95

Tested by 1