Skip to content
This repository was archived by the owner on Sep 11, 2025. It is now read-only.

Commit 5fb40b5

Browse files
.
1 parent 5a312b7 commit 5fb40b5

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

runtime/actors/actorsystem.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,15 @@ func loadAgentActors(ctx context.Context, plugin *plugins.Plugin) error {
9292
actors := _actorSystem.Actors()
9393
runningAgents := make(map[string]bool, len(actors))
9494
for _, pid := range actors {
95-
if actor, ok := pid.Actor().(*wasmAgentActor); ok {
96-
go func() {
95+
go func(f_ctx context.Context, f_pid *goakt.PID) {
96+
if actor, ok := f_pid.Actor().(*wasmAgentActor); ok {
9797
runningAgents[actor.agentId] = true
9898
actor.plugin = plugin
99-
if err := pid.Restart(ctx); err != nil {
100-
logger.Err(ctx, err).Msgf("Failed to restart actor for agent %s.", actor.agentId)
99+
if err := f_pid.Restart(f_ctx); err != nil {
100+
logger.Err(f_ctx, err).Msgf("Failed to restart actor for agent %s.", actor.agentId)
101101
}
102-
}()
103-
}
102+
}
103+
}(ctx, pid)
104104
}
105105

106106
// spawn actors for agents with state in the database, that are not already running
@@ -114,11 +114,11 @@ func loadAgentActors(ctx context.Context, plugin *plugins.Plugin) error {
114114
host := wasmhost.GetWasmHost(ctx)
115115
for _, agent := range agents {
116116
if !runningAgents[agent.Id] {
117-
go func() {
118-
if _, err := spawnActorForAgent(host, plugin, agent.Id, agent.Name, false); err != nil {
119-
logger.Err(ctx, err).Msgf("Failed to spawn actor for agent %s.", agent.Id)
117+
go func(f_ctx context.Context, agentId string, agentName string) {
118+
if _, err := spawnActorForAgent(host, plugin, agentId, agentName, false); err != nil {
119+
logger.Err(f_ctx, err).Msgf("Failed to spawn actor for agent %s.", agentId)
120120
}
121-
}()
121+
}(ctx, agent.Id, agent.Name)
122122
}
123123
}
124124

0 commit comments

Comments
 (0)