hashicorp / hashicorp/consul

Thoughts on double adjustment of TTL

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

Description

I have noticed #2347

in [session_ttl.go](https://github.com/hashicorp/consul/blob/v0.8.1/consul/session_ttl.go#L84-L89)
```go
// Adjust the given TTL by the TTL multiplier. This is done
// to give a client a grace period and to compensate for network
// and processing delays. The contract is that a session is not expired
// before the TTL, but there is no explicit promise about the upper
// bound so this is allowable.
ttl = ttl * structs.SessionTTLMultiplier
```

Firstly, it took me a little while to find this answer after I found the problem while using ttl, as it was not explicitly reflected in the documentation.

Although the [session documentation](https://developer.hashicorp.com/consul/api-docs/session#ttl) mentions "double this TTL", it is not clear, it seems to be expressing a special case, but I always come across it.

Therefore, I think the documentation should at least be improved.

Then, the multiplier increases the actual ttl significantly, the larger the ttl, the larger the actual ttl. I wonder if an adder would make more sense? As in `+3s`

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.