()
| 307 | } |
| 308 | |
| 309 | func (c *chatConfigCache) cachedDefaultModelConfig() (database.ChatModelConfig, bool) { |
| 310 | c.mu.RLock() |
| 311 | entry := c.defaultModelConfig |
| 312 | c.mu.RUnlock() |
| 313 | if entry == nil { |
| 314 | return database.ChatModelConfig{}, false |
| 315 | } |
| 316 | if c.clock.Now().Before(entry.expiresAt) { |
| 317 | return cloneModelConfig(entry.config), true |
| 318 | } |
| 319 | |
| 320 | c.mu.Lock() |
| 321 | if current := c.defaultModelConfig; current != nil && !c.clock.Now().Before(current.expiresAt) { |
| 322 | c.defaultModelConfig = nil |
| 323 | } |
| 324 | c.mu.Unlock() |
| 325 | |
| 326 | return database.ChatModelConfig{}, false |
| 327 | } |
| 328 | |
| 329 | func (c *chatConfigCache) defaultModelConfigSnapshot() modelConfigSnapshot { |
| 330 | c.mu.RLock() |
no test coverage detected