google-cloud-go icon indicating copy to clipboard operation
google-cloud-go copied to clipboard

metadata: support cancellation of GCE platform detection

Open diurnalist opened this issue 9 months ago • 1 comments

Is your feature request related to a problem? Please describe.

Currently the OnGCE call can block for an indeterminate amount of time, depending on the result of resolving the metadata IP address and/or its DNS record. This cannot be canceled via any mechanism by the caller presently, which prevents the caller from putting a ceiling on the call duration for a more reliable experience.

Describe the solution you'd like

Similar to other context-aware functions in the package, OnGCE should take a context.

Describe alternatives you've considered

There is no other way to prevent this situation currently, unless the caller executes this in an entirely different process.

Additional context

n/a

diurnalist avatar Mar 08 '25 20:03 diurnalist

@diurnalist Thank you for opening this issue and the accompanying PR. We will look at it this week. Much appreciated.

quartzmo avatar Mar 10 '25 18:03 quartzmo