no need to defer here

Signed-off-by: mudler <mudler@localai.io>
This commit is contained in:
mudler
2025-03-23 11:57:01 +01:00
parent fa25e7c077
commit f0b8bfb4f4

View File

@@ -158,14 +158,12 @@ func (a *AgentPool) CreateAgent(name string, agentConfig *AgentConfig) error {
return err return err
} }
defer func(ac AgentConfig, pool *AgentPool) { go func(ac AgentConfig, pool *AgentPool) {
go func(ac AgentConfig, pool *AgentPool) { // Create the agent avatar
// Create the agent avatar if err := a.createAgentAvatar(ac); err != nil {
if err := a.createAgentAvatar(ac); err != nil { xlog.Error("Failed to create agent avatar", "error", err)
xlog.Error("Failed to create agent avatar", "error", err) }
} }(a.pool[name], a)
}(ac, pool)
}(*agentConfig, a)
return a.startAgentWithConfig(name, agentConfig) return a.startAgentWithConfig(name, agentConfig)
} }