Skip to content

Commit 751c9c1

Browse files
committed
refactor: update event handling to subscribe to postprovision events for real-time dashboard updates
1 parent 7f28b37 commit 751c9c1

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

cli/src/cmd/app/commands/listen.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ func NewListenCommand() *cobra.Command {
3030
}
3131
defer azdClient.Close()
3232

33-
// Create an extension host and subscribe to environment update events
33+
// Create an extension host and subscribe to postprovision events
3434
// This allows us to push real-time updates to the dashboard when azd provision completes
35+
// Note: We don't filter by Host or Language, so this will apply to all services
3536
host := azdext.NewExtensionHost(azdClient).
36-
WithServiceEventHandler("environment updated", handleEnvironmentUpdate, nil)
37+
WithServiceEventHandler("postprovision", handlePostProvision, &azdext.ServiceEventOptions{})
3738

3839
// Start the extension host
3940
// This blocks until azd closes the connection
@@ -47,10 +48,10 @@ func NewListenCommand() *cobra.Command {
4748
}
4849
}
4950

50-
// handleEnvironmentUpdate is called when azd environment variables are updated (e.g., after provision).
51+
// handlePostProvision is called after azd provision completes for each service.
5152
// This handler refreshes the dashboard to show the latest environment values.
52-
func handleEnvironmentUpdate(ctx context.Context, args *azdext.ServiceEventArgs) error {
53-
log.Printf("[azd-app] Environment updated event received for service: %s", args.Service.GetName())
53+
func handlePostProvision(ctx context.Context, args *azdext.ServiceEventArgs) error {
54+
log.Printf("[azd-app] Post-provision event received for service: %s", args.Service.GetName())
5455

5556
// The environment variables are now updated in the process by azd
5657
// We just need to trigger a refresh of the cached environment and broadcast to dashboards

0 commit comments

Comments
 (0)