Extends the session TTL max to 24 hours, and adds a warning to the docs.

pull/1412/head
James Phillips 2015-11-14 15:30:53 -08:00
parent a4b53aa531
commit f1f9d30ade
3 changed files with 10 additions and 7 deletions

View File

@ -522,18 +522,18 @@ func TestSessionEndpoint_Apply_BadTTL(t *testing.T) {
if err == nil { if err == nil {
t.Fatal("expected error") t.Fatal("expected error")
} }
if err.Error() != "Invalid Session TTL '5000000000', must be between [10s=1h0m0s]" { if err.Error() != "Invalid Session TTL '5000000000', must be between [10s=24h0m0s]" {
t.Fatalf("incorrect error message: %s", err.Error()) t.Fatalf("incorrect error message: %s", err.Error())
} }
// more than SessionTTLMax // more than SessionTTLMax
arg.Session.TTL = "4000s" arg.Session.TTL = "100000s"
err = msgpackrpc.CallWithCodec(codec, "Session.Apply", &arg, &out) err = msgpackrpc.CallWithCodec(codec, "Session.Apply", &arg, &out)
if err == nil { if err == nil {
t.Fatal("expected error") t.Fatal("expected error")
} }
if err.Error() != "Invalid Session TTL '4000000000000', must be between [10s=1h0m0s]" { if err.Error() != "Invalid Session TTL '100000000000000', must be between [10s=24h0m0s]" {
t.Fatalf("incorrect error message: %s", err.Error()) t.Fatalf("incorrect error message: %s", err.Error())
} }
} }

View File

@ -547,7 +547,7 @@ const (
) )
const ( const (
SessionTTLMax = 3600 * time.Second SessionTTLMax = 24 * time.Hour
SessionTTLMultiplier = 2 SessionTTLMultiplier = 2
) )

View File

@ -65,10 +65,13 @@ causes any locks that are held to be deleted. `delete` is useful for creating ep
key/value entries. key/value entries.
The `TTL` field is a duration string, and like `LockDelay` it can use "s" as The `TTL` field is a duration string, and like `LockDelay` it can use "s" as
a suffix for seconds. If specified, it must be between 10s and 3600s currently. a suffix for seconds. If specified, it must be between 10s and 86400s currently.
When provided, the session is invalidated if it is not renewed before the TTL When provided, the session is invalidated if it is not renewed before the TTL
expires. See the [session internals page](/docs/internals/sessions.html) for more expires. The lowest practical TTL should be used to keep the number of managed
documentation of this feature. sessions low. When locks are forcibly expired, such as during a leader election,
sessions may not be reaped for up to double this TTL, so long TTL values (>1 hour)
should be avoided. See the [session internals page](/docs/internals/sessions.html)
for more documentation of this feature.
The return code is 200 on success and returns the ID of the created session: The return code is 200 on success and returns the ID of the created session: