mirror of
https://github.com/lordmathis/llamactl.git
synced 2025-11-06 09:04:27 +00:00
Enforce maximum running instances limit in StartInstance method
This commit is contained in:
@@ -181,6 +181,10 @@ func (im *instanceManager) StartInstance(name string) (*instance.Process, error)
|
|||||||
return instance, fmt.Errorf("instance with name %s is already running", name)
|
return instance, fmt.Errorf("instance with name %s is already running", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(im.runningInstances) >= im.instancesConfig.MaxRunningInstances && im.instancesConfig.MaxRunningInstances != -1 {
|
||||||
|
return nil, fmt.Errorf("maximum number of running instances (%d) reached", im.instancesConfig.MaxRunningInstances)
|
||||||
|
}
|
||||||
|
|
||||||
if err := instance.Start(); err != nil {
|
if err := instance.Start(); err != nil {
|
||||||
return nil, fmt.Errorf("failed to start instance %s: %w", name, err)
|
return nil, fmt.Errorf("failed to start instance %s: %w", name, err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user