mirror of
https://github.com/lordmathis/llamactl.git
synced 2025-11-06 09:04:27 +00:00
Refactor NodeConfig handling to use a map
This commit is contained in:
@@ -63,15 +63,16 @@ type instanceManager struct {
|
||||
}
|
||||
|
||||
// NewInstanceManager creates a new instance of InstanceManager.
|
||||
func NewInstanceManager(backendsConfig config.BackendConfig, instancesConfig config.InstancesConfig, nodesConfig []config.NodeConfig) InstanceManager {
|
||||
func NewInstanceManager(backendsConfig config.BackendConfig, instancesConfig config.InstancesConfig, nodesConfig map[string]config.NodeConfig) InstanceManager {
|
||||
if instancesConfig.TimeoutCheckInterval <= 0 {
|
||||
instancesConfig.TimeoutCheckInterval = 5 // Default to 5 minutes if not set
|
||||
}
|
||||
|
||||
// Build node config map for quick lookup
|
||||
nodeConfigMap := make(map[string]*config.NodeConfig)
|
||||
for i := range nodesConfig {
|
||||
nodeConfigMap[nodesConfig[i].Name] = &nodesConfig[i]
|
||||
for name := range nodesConfig {
|
||||
nodeCopy := nodesConfig[name]
|
||||
nodeConfigMap[name] = &nodeCopy
|
||||
}
|
||||
|
||||
im := &instanceManager{
|
||||
|
||||
Reference in New Issue
Block a user