ax(mining): rename minerCfg loop variable to autostartEntry
`minerCfg` is an abbreviated name for `MinerAutostartConfig` loop variables. Renamed to `autostartEntry` across three range loops in manager.go for AX Principle 1 compliance (predictable names over short names). Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
parent
44811e84fd
commit
5a6da79311
1 changed files with 10 additions and 10 deletions
|
|
@ -202,11 +202,11 @@ func (m *Manager) autostartMiners() {
|
|||
return
|
||||
}
|
||||
|
||||
for _, minerCfg := range cfg.Miners {
|
||||
if minerCfg.Autostart && minerCfg.Config != nil {
|
||||
logging.Info("autostarting miner", logging.Fields{"type": minerCfg.MinerType})
|
||||
if _, err := m.StartMiner(context.Background(), minerCfg.MinerType, minerCfg.Config); err != nil {
|
||||
logging.Error("failed to autostart miner", logging.Fields{"type": minerCfg.MinerType, "error": err})
|
||||
for _, autostartEntry := range cfg.Miners {
|
||||
if autostartEntry.Autostart && autostartEntry.Config != nil {
|
||||
logging.Info("autostarting miner", logging.Fields{"type": autostartEntry.MinerType})
|
||||
if _, err := m.StartMiner(context.Background(), autostartEntry.MinerType, autostartEntry.Config); err != nil {
|
||||
logging.Error("failed to autostart miner", logging.Fields{"type": autostartEntry.MinerType, "error": err})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -369,9 +369,9 @@ func (m *Manager) UninstallMiner(ctx context.Context, minerType string) error {
|
|||
|
||||
return UpdateMinersConfig(func(cfg *MinersConfig) error {
|
||||
var updatedMiners []MinerAutostartConfig
|
||||
for _, minerCfg := range cfg.Miners {
|
||||
if !strings.EqualFold(minerCfg.MinerType, minerType) {
|
||||
updatedMiners = append(updatedMiners, minerCfg)
|
||||
for _, autostartEntry := range cfg.Miners {
|
||||
if !strings.EqualFold(autostartEntry.MinerType, minerType) {
|
||||
updatedMiners = append(updatedMiners, autostartEntry)
|
||||
}
|
||||
}
|
||||
cfg.Miners = updatedMiners
|
||||
|
|
@ -383,8 +383,8 @@ func (m *Manager) UninstallMiner(ctx context.Context, minerType string) error {
|
|||
func (m *Manager) updateMinerConfig(minerType string, autostart bool, config *Config) error {
|
||||
return UpdateMinersConfig(func(cfg *MinersConfig) error {
|
||||
found := false
|
||||
for i, minerCfg := range cfg.Miners {
|
||||
if strings.EqualFold(minerCfg.MinerType, minerType) {
|
||||
for i, autostartEntry := range cfg.Miners {
|
||||
if strings.EqualFold(autostartEntry.MinerType, minerType) {
|
||||
cfg.Miners[i].Autostart = autostart
|
||||
cfg.Miners[i].Config = config
|
||||
found = true
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue