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

Function SetModelRefreshCallback

internal/registry/model_updater.go:52–65  ·  view source on GitHub ↗

SetModelRefreshCallback registers a callback that is invoked when startup or periodic model refresh detects changes. Only one callback is supported; subsequent calls replace the previous callback.

(cb ModelRefreshCallback)

Source from the content-addressed store, hash-verified

50// periodic model refresh detects changes. Only one callback is supported;
51// subsequent calls replace the previous callback.
52func SetModelRefreshCallback(cb ModelRefreshCallback) {
53 refreshCallbackMu.Lock()
54 refreshCallback = cb
55 var pending []string
56 if cb != nil && len(pendingRefreshChanges) > 0 {
57 pending = append([]string(nil), pendingRefreshChanges...)
58 pendingRefreshChanges = nil
59 }
60 refreshCallbackMu.Unlock()
61
62 if cb != nil && len(pending) > 0 {
63 cb(pending)
64 }
65}
66
67func init() {
68 // Load embedded data as fallback on startup.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected