MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / GetExposedData

Function GetExposedData

setting/ratio_setting/exposed_cache.go:35–55  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

33}
34
35func GetExposedData() gin.H {
36 if c, ok := exposedData.Load().(*exposedCache); ok && c != nil && time.Now().Before(c.expiresAt) {
37 return cloneGinH(c.data)
38 }
39 rebuildMu.Lock()
40 defer rebuildMu.Unlock()
41 if c, ok := exposedData.Load().(*exposedCache); ok && c != nil && time.Now().Before(c.expiresAt) {
42 return cloneGinH(c.data)
43 }
44 newData := gin.H{
45 "model_ratio": GetModelRatioCopy(),
46 "completion_ratio": GetCompletionRatioCopy(),
47 "cache_ratio": GetCacheRatioCopy(),
48 "model_price": GetModelPriceCopy(),
49 }
50 exposedData.Store(&exposedCache{
51 data: newData,
52 expiresAt: time.Now().Add(exposedDataTTL),
53 })
54 return cloneGinH(newData)
55}

Callers 2

FetchUpstreamRatiosFunction · 0.92
GetRatioConfigFunction · 0.92

Calls 6

cloneGinHFunction · 0.85
GetModelRatioCopyFunction · 0.85
GetCompletionRatioCopyFunction · 0.85
GetCacheRatioCopyFunction · 0.85
GetModelPriceCopyFunction · 0.85
AddMethod · 0.80

Tested by

no test coverage detected