hashicorp / hashicorp/consul

Improve Lock Session LockDelay handling inc. lockDelayThreshold

Open
#9,388 0 comments 0 reactions 0 assignees View on GitHub
type/enhancement
Dominant language
Go
Stars
30.1k
Forks
4.6k
Avg merge
2d 6h
Merged PRs (30d)
43

Description

We do some conversion to convert a lock delay of anything less than `1000ns` to seconds.

https://github.com/hashicorp/consul/blob/0c3db76c922f1e5458ec3b5ece01509fb37f17ab/agent/structs/structs.go#L2220-L2236

There's some more info on this here:

https://github.com/hashicorp/consul/blob/0c3db76c922f1e5458ec3b5ece01509fb37f17ab/agent/structs/structs.go#L155-L161

---

When using the API to create a new Lock Session with a `LockDelay` using a string of "5" as the `LockDelay` I get the following error:

`Request decode failed: time: missing unit in duration "5"`

Whereas a `5` as an integer is assumed to be seconds and `5000` is assumed nanoseconds.

Overall its a little confusing and I can't see any public documentation around this, so might be an idea to improve this or at least provide some API documentation detailing this.

cc @mkeeler

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.