autopilot/manager: fix slice modifications
When appending to a slice, there is no guarantee the slice won't be modified. So instead of appending to the global slice availableHeuristics, we create a temporary local one.
This commit is contained in:
parent
df5baa4275
commit
f0ba4be758
@ -319,8 +319,12 @@ func (m *Manager) queryHeuristics(nodes map[NodeID]struct{}, localState bool) (
|
|||||||
|
|
||||||
// We'll start by getting the scores from each available sub-heuristic,
|
// We'll start by getting the scores from each available sub-heuristic,
|
||||||
// in addition the current agent heuristic.
|
// in addition the current agent heuristic.
|
||||||
|
var heuristics []AttachmentHeuristic
|
||||||
|
heuristics = append(heuristics, availableHeuristics...)
|
||||||
|
heuristics = append(heuristics, m.cfg.PilotCfg.Heuristic)
|
||||||
|
|
||||||
report := make(HeuristicScores)
|
report := make(HeuristicScores)
|
||||||
for _, h := range append(availableHeuristics, m.cfg.PilotCfg.Heuristic) {
|
for _, h := range heuristics {
|
||||||
name := h.Name()
|
name := h.Name()
|
||||||
|
|
||||||
// If the agent heuristic is among the simple heuristics it
|
// If the agent heuristic is among the simple heuristics it
|
||||||
|
Loading…
Reference in New Issue
Block a user