fix: remove eager beads store initialization at startup

The beads store was being opened unconditionally at startup, causing
crashes when the database was corrupted or incompatible. Now it's only
opened on-demand when actually needed.
This commit is contained in:
Levi Neely 2026-03-01 00:41:39 +01:00
parent 788d97307f
commit 33dbc312b0
1 changed files with 1 additions and 18 deletions

View File

@ -20,7 +20,6 @@ import (
"time"
"9fans.net/go/plan9/client"
bd "github.com/steveyegge/beads"
"go.uber.org/zap"
)
@ -212,24 +211,8 @@ func start(daemonize bool) {
}
}()
// Create shared beads store (namespace-agnostic, persistent on disk)
beadsDir := os.Getenv("ANVILLM_BEADS_PATH")
if beadsDir == "" {
beadsDir = filepath.Join(os.Getenv("HOME"), ".beads")
}
logging.Logger().Debug("initializing beads store", zap.String("path", beadsDir))
beadsStore, err := bd.OpenFromConfig(context.Background(), beadsDir)
if err != nil {
logging.Logger().Warn("failed to initialize beads store", zap.Error(err))
beadsStore = nil // Continue without beads support
}
if beadsStore != nil {
defer beadsStore.Close()
logging.Logger().Info("beads store initialized", zap.String("path", beadsDir))
}
// Start 9P server
srv, err := p9.NewServer(mgr, beadsStore)
srv, err := p9.NewServer(mgr, nil)
if err != nil {
logging.Logger().Fatal("failed to start 9P server", zap.Error(err))
}