Remove cache fields from Server struct (bd-31)

- Removed storageCache, cacheMu, maxCacheSize, cacheTTL, cleanupTicker fields
- Removed cacheHits and cacheMisses metrics
- Removed cache size/TTL parsing from env vars in NewServer()
- Removed cleanup ticker goroutine from Start()
- Removed cache cleanup logic from Stop()
- Part of bd-29 epic to remove daemon storage cache

Amp-Thread-ID: https://ampcode.com/threads/T-239a5531-68a5-4c98-b85d-0e3512b2553c
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Steve Yegge
2025-10-27 23:20:06 -07:00
parent c7477464fc
commit 9edcb6f19f
2 changed files with 1 additions and 45 deletions

View File

@@ -49,7 +49,6 @@ func (s *Server) Start(_ context.Context) error {
close(s.readyChan)
go s.handleSignals()
go s.runCleanupLoop()
// Ensure cleanup is signaled when this function returns
defer close(s.doneChan)
@@ -107,23 +106,7 @@ func (s *Server) Stop() error {
// Signal cleanup goroutine to stop
close(s.shutdownChan)
// Close all cached storage connections outside lock
s.cacheMu.Lock()
stores := make([]storage.Storage, 0, len(s.storageCache))
for _, entry := range s.storageCache {
stores = append(stores, entry.store)
}
s.storageCache = make(map[string]*StorageCacheEntry)
s.cacheMu.Unlock()
// Close stores without holding lock
for _, store := range stores {
if closeErr := store.Close(); closeErr != nil {
fmt.Fprintf(os.Stderr, "Warning: failed to close storage: %v\n", closeErr)
}
}
// Close default storage
// Close storage
if s.storage != nil {
if closeErr := s.storage.Close(); closeErr != nil {
fmt.Fprintf(os.Stderr, "Warning: failed to close default storage: %v\n", closeErr)