Skip to content
Merged
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: 5 additions & 2 deletions services/core/internal/sandbox/opensandbox/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,13 @@ func newProvider(c sandbox.DirectConfig) (*Provider, error) {
return nil, errors.New("OpenSandbox deployment configuration is unavailable")
}
scheme, _, _ := strings.Cut(deployment.APIURL, "://")
// Every call reaches the same server, so one transport keeps its connections
// alive; without it the SDK builds a new transport per connected sandbox.
client := &http.Client{Transport: osdk.DefaultTransport()}
return &Provider{
installation: c.InstallationID, image: deployment.Image, resources: c.Selection.Resources,
connection: osdk.ConnectionConfig{Domain: deployment.APIURL, Protocol: scheme, APIKey: deployment.APIKey, UseServerProxy: true},
lifecycle: osdk.NewLifecycleClient(deployment.APIURL+"/"+osdk.APIVersion, deployment.APIKey),
connection: osdk.ConnectionConfig{Domain: deployment.APIURL, Protocol: scheme, APIKey: deployment.APIKey, UseServerProxy: true, HTTPClient: client},
lifecycle: osdk.NewLifecycleClient(deployment.APIURL+"/"+osdk.APIVersion, deployment.APIKey, osdk.WithHTTPClient(client)),
resolve: func(ctx context.Context, host string) ([]netip.Addr, error) {
return net.DefaultResolver.LookupNetIP(ctx, "ip", host)
},
Expand Down
Loading