Description
Describe the bug
RequestTimeout field on GlideClientConfiguration was recently updated to use a time.Duration
to represent the timeout value. Prior to the change, the value was an int and documented to contain a value representing milliseconds. A time.Duration
struct represents time as nanoseconds:
// A Duration represents the elapsed time between two instants
// as an int64 nanosecond count. The representation limits the
// largest representable duration to approximately 290 years.
type Duration int64
const (
minDuration Duration = -1 << 63
maxDuration Duration = 1<<63 - 1
)
The Duration
value needs to be converted from nanoseconds to milliseconds in the toProtobuf
implementation and should be validated in the WithRequestTimeout
function to ensure it does not exceed the bounds of the uint32
type so the narrowing cast in toProtobuf
does not result in an error.
Expected Behavior
RequestTimeout is expected to represent milliseconds in Glide-core. The time.Duration type should be appropriately constrained and converted to ensure proper operation.
Current Behavior
RequestTimeout value is improperly converted, and has undefined behavior for some Duration
values.
Reproduction Steps
See description.
Possible Solution
No response
Additional Information/Context
No response
Client version used
2.0
Engine type and version
Any
OS
Any
Language
Go
Language Version
1.22
Cluster information
No response
Logs
No response
Other information
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status