mirror of
https://github.com/lordmathis/llamactl.git
synced 2025-11-05 16:44:22 +00:00
Refactor instance creation to initialize logger, proxy, and process only for local instances
This commit is contained in:
@@ -36,9 +36,6 @@ func New(name string, globalBackendSettings *config.BackendConfig, globalInstanc
|
|||||||
// Validate and copy options
|
// Validate and copy options
|
||||||
opts.ValidateAndApplyDefaults(name, globalInstanceSettings)
|
opts.ValidateAndApplyDefaults(name, globalInstanceSettings)
|
||||||
|
|
||||||
// Create the instance logger
|
|
||||||
logger := NewLogger(name, globalInstanceSettings.LogsDir)
|
|
||||||
|
|
||||||
// Create status wrapper
|
// Create status wrapper
|
||||||
status := newStatus(Stopped)
|
status := newStatus(Stopped)
|
||||||
status.onStatusChange = onStatusChange
|
status.onStatusChange = onStatusChange
|
||||||
@@ -52,16 +49,17 @@ func New(name string, globalBackendSettings *config.BackendConfig, globalInstanc
|
|||||||
globalInstanceSettings: globalInstanceSettings,
|
globalInstanceSettings: globalInstanceSettings,
|
||||||
globalBackendSettings: globalBackendSettings,
|
globalBackendSettings: globalBackendSettings,
|
||||||
localNodeName: localNodeName,
|
localNodeName: localNodeName,
|
||||||
logger: logger,
|
|
||||||
Created: time.Now().Unix(),
|
Created: time.Now().Unix(),
|
||||||
status: status,
|
status: status,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create Proxy component
|
// Only create logger, proxy, and process for local instances
|
||||||
instance.proxy = NewProxy(instance)
|
// Remote instances are metadata only (no logger, proxy, or process)
|
||||||
|
if !instance.IsRemote() {
|
||||||
// Create Process component (will be initialized on first Start)
|
instance.logger = NewLogger(name, globalInstanceSettings.LogsDir)
|
||||||
instance.process = newProcess(instance)
|
instance.proxy = NewProxy(instance)
|
||||||
|
instance.process = newProcess(instance)
|
||||||
|
}
|
||||||
|
|
||||||
return instance
|
return instance
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user