Skip to content
Closed
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
16 changes: 11 additions & 5 deletions packages/envd/internal/api/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,11 +294,17 @@ func (a *API) PostInit(w http.ResponseWriter, r *http.Request) {
a.initialized.Store(true)
}

go func() { //nolint:contextcheck // TODO: fix this later
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
defer cancel()
host.PollForMMDSOpts(ctx, a.mmdsChan, a.defaults.EnvVars)
}()
// MMDS is only served by the Firecracker-based deployment: containerized
// environments (isNotFC) have no metadata service, where the futile polling
// leaks dangling in-flight connections and can break runsc checkpointing.
// Mirror the guard in main.go and skip it.
if !a.isNotFC {
go func() { //nolint:contextcheck // TODO: fix this later
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
defer cancel()
host.PollForMMDSOpts(ctx, a.mmdsChan, a.defaults.EnvVars)
}()
}

// After SetData, so this reports what is actually in effect rather than what was
// requested. Set before WriteHeader.
Expand Down