hashicorp / hashicorp/consul

session.RenewPeriodic description is unclean

Open
#9,506 1 comment 0 reactions 0 assignees View on GitHub
needs-discussion theme/internal-cleanup type/question
Dominant language
Go
Stars
30.1k
Forks
4.6k
Avg merge
2d 6h
Merged PRs (30d)
43

Description

#### Overview of the Issue

https://github.com/hashicorp/consul/blob/87f6617eecd23a64add1e79eb3cd8dc3da9e649e/api/session.go#L164

Description of RenewPeriodic says that it is renewing a long-running session. But it is incorrect because it is also DESTROY session if doneCh is closed. It leads to a lot of confusion if you assume to reuse the session later.

https://github.com/hashicorp/consul/blob/87f6617eecd23a64add1e79eb3cd8dc3da9e649e/api/session.go#L201

#### Reproduction Steps

For example, we have multiple go routines running RenewPeriodic that following each other. I expect that the last routine will keep the session until TTL expired. If the session is required, then we renew the session ID. If not, then Consul will delete all resources after a while.

### Consul info

```
build:
prerelease =
revision = ca5c3894
version = 1.9.1
```

### Proposal

Is it possible to fix Golang description or add a boolean flag indicating whether Consul should delete the session or not?

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.