Skip to content

Commit

Permalink
Use child context in watchAgents (#5888)
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin Su <[email protected]>
  • Loading branch information
pingsutw authored Oct 23, 2024
1 parent 9d63d0a commit 0472cbb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions flyteplugins/go/tasks/plugins/webapi/agent/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,10 @@ func (p *Plugin) getAsyncAgentClient(ctx context.Context, agent *Deployment) (se

func (p *Plugin) watchAgents(ctx context.Context, agentService *core.AgentService) {
go wait.Until(func() {
clientSet := getAgentClientSets(ctx)
agentRegistry := getAgentRegistry(ctx, clientSet)
childCtx, cancel := context.WithCancel(ctx)
defer cancel()
clientSet := getAgentClientSets(childCtx)
agentRegistry := getAgentRegistry(childCtx, clientSet)
p.setRegistry(agentRegistry)
agentService.SetSupportedTaskType(maps.Keys(agentRegistry))
}, p.cfg.PollInterval.Duration, ctx.Done())
Expand Down

0 comments on commit 0472cbb

Please sign in to comment.