optimizer: copy param slice

This commit is contained in:
c9s 2022-06-06 06:39:27 +08:00
parent 0f6989af8b
commit 43c2819d01
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -135,13 +135,16 @@ func (o *GridOptimizer) Run(executor Executor, configJson []byte) ([]Metric, err
// TODO: Add more metric value function
metricValue := TotalProfitMetricValueFunc(summaryReport)
var currentParams []interface{}
copy(currentParams, o.CurrentParams)
metrics = append(metrics, Metric{
Params: o.CurrentParams,
Params: currentParams,
Labels: o.ParamLabels,
Value: metricValue,
})
log.Infof("current params: %+v => %+v", o.CurrentParams, metricValue)
log.Infof("current params: %+v => %+v", currentParams, metricValue)
return nil
}