Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions cli/azd/cmd/middleware/extensions.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func (m *ExtensionsMiddleware) Run(ctx context.Context, next NextFn) (*actions.A

// Wait for the extension to signal readiness or failure.
// If AZD_EXT_DEBUG is set to a truthy value, wait indefinitely for debugger attachment
// If AZD_EXT_TIMEOUT is set to a number (seconds), use that as the timeout (default: 5 seconds)
// If AZD_EXT_TIMEOUT is set to a number (seconds), use that as the timeout (default: 15 seconds)
readyCtx, cancel := getReadyContext(ctx)
defer cancel()

Expand Down Expand Up @@ -345,8 +345,9 @@ func getReadyContext(ctx context.Context) (context.Context, context.CancelFunc)
return context.WithCancel(ctx)
}

// Use custom timeout from environment variable or default to 5 seconds
timeout := 5 * time.Second
// Use custom timeout from environment variable or default to 15 seconds.
// 15s accommodates Windows cold-start overhead (Defender scanning, process creation).
timeout := 15 * time.Second
if timeoutValue := os.Getenv("AZD_EXT_TIMEOUT"); timeoutValue != "" {
if seconds, err := strconv.Atoi(timeoutValue); err == nil && seconds > 0 {
timeout = time.Duration(seconds) * time.Second
Expand Down
8 changes: 2 additions & 6 deletions cli/azd/internal/grpcserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func (s *Server) Start() (*ServerInfo, error) {
azdext.RegisterAiModelServiceServer(s.grpcServer, s.aiModelService)
azdext.RegisterCopilotServiceServer(s.grpcServer, s.copilotService)

serverInfo.Address = fmt.Sprintf("localhost:%d", randomPort)
serverInfo.Address = fmt.Sprintf("127.0.0.1:%d", randomPort)
serverInfo.Port = randomPort
serverInfo.SigningKey = signingKey

Expand All @@ -140,11 +140,7 @@ func (s *Server) Start() (*ServerInfo, error) {

log.Printf("azd gRPC Server listening on port %d", randomPort)

return &ServerInfo{
Address: fmt.Sprintf("localhost:%d", randomPort),
Port: randomPort,
SigningKey: signingKey,
}, nil
return &serverInfo, nil
}

func (s *Server) Stop() error {
Expand Down
Loading