fix(store): SetHostAlwaysOn returns ErrNotFound; test agent-token lookup path

This commit is contained in:
2026-06-15 20:56:59 +01:00
parent ff65d39f25
commit 4c9641b6ed
2 changed files with 13 additions and 1 deletions
+4 -1
View File
@@ -388,11 +388,14 @@ func (s *Store) SetHostAlwaysOn(ctx context.Context, hostID string, alwaysOn boo
if alwaysOn {
v = 1
}
_, err := s.db.ExecContext(ctx,
res, err := s.db.ExecContext(ctx,
`UPDATE hosts SET always_on = ? WHERE id = ?`, v, hostID)
if err != nil {
return fmt.Errorf("store: set host always_on: %w", err)
}
if n, _ := res.RowsAffected(); n == 0 {
return ErrNotFound
}
return nil
}