fix zombie leak, add quiet-hours toggle, improve query reply, configurable router threshold, JS dashboard

This commit is contained in:
kami
2026-07-03 00:42:35 +02:00
parent 612583d59a
commit e00cb07658
26 changed files with 3652 additions and 15 deletions
+8 -2
View File
@@ -36,7 +36,10 @@ func (s *Store) WriteFact(ctx context.Context, ts time.Time, kind FactKind, key,
if err != nil {
return 0, fmt.Errorf("write fact: %w", err)
}
id, _ := res.LastInsertId()
id, err := res.LastInsertId()
if err != nil {
return 0, fmt.Errorf("last insert id: %w", err)
}
return id, nil
}
@@ -156,7 +159,10 @@ func (s *Store) CorrectValue(ctx context.Context, key, source string, value any,
if err := tx.Commit(); err != nil {
return 0, err
}
newID, _ = res.LastInsertId()
newID, err = res.LastInsertId()
if err != nil {
return 0, fmt.Errorf("last insert id: %w", err)
}
return newID, nil
}
+4 -1
View File
@@ -28,7 +28,10 @@ func (s *Store) WriteNote(ctx context.Context, ts time.Time, text string, embedd
if err != nil {
return 0, fmt.Errorf("write note: %w", err)
}
id, _ := res.LastInsertId()
id, err := res.LastInsertId()
if err != nil {
return 0, fmt.Errorf("last insert id: %w", err)
}
return id, nil
}
+3 -1
View File
@@ -70,7 +70,9 @@ func Open(ctx context.Context, path string) (*Store, error) {
// single writer expected; the daemon is the only process touching the db.
db.SetMaxOpenConns(1)
if _, err := db.ExecContext(ctx, schemaSQL); err != nil {
_ = db.Close()
if closeErr := db.Close(); closeErr != nil {
return nil, fmt.Errorf("apply schema: %w (close: %v)", err, closeErr)
}
return nil, fmt.Errorf("apply schema: %w", err)
}
return &Store{db: db}, nil