chore: reduce ttl
Chang committed
Mar 8, 2026 at 12:55 UTC
167cb49d926a3cfd387b5d6ae547ccc7a2066fda
3 files changed
+7
-3
cmd/demo-app/main.go
+5
-1
@@ -2,6 +2,7 @@ package main
2
3
import (
4
"context"
5
+ "errors"
6
"flag"
7
"fmt"
8
"os"
@@ -50,7 +51,7 @@ func main() {
51
52
func runDemo() error {
53
logger := log.With().Str("component", "demo-app").Logger()
53
- ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
54
+ ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP)
55
defer stop()
56
57
exposure, err := sdk.Expose(ctx, sdk.SplitCSV(flagServerURLs), flagName, types.LeaseMetadata{
@@ -73,6 +74,9 @@ func runDemo() error {
74
return fmt.Errorf("invalid --addr value %q: %w", flagAddr, err)
75
}
76
if err := exposure.RunHTTP(ctx, newHandler(), flagAddr); err != nil {
77
+ if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
78
+ err = nil
79
+ }
80
return err
81
}
82
portal/helpers.go
+1
-1
@@ -10,7 +10,7 @@ import (
10
)
11
12
const (
13
- defaultLeaseTTL = 2 * time.Minute
13
+ defaultLeaseTTL = 30 * time.Second
14
defaultClaimTimeout = 10 * time.Second
15
defaultIdleKeepalive = 15 * time.Second
16
defaultReadyQueueLimit = 8
sdk/client.go
+1
-1
@@ -26,7 +26,7 @@ const (
26
defaultDialTimeout = 5 * time.Second
27
defaultRequestTimeout = 15 * time.Second
28
defaultHandshakeTimeout = 15 * time.Second
29
- defaultLeaseTTL = 2 * time.Minute
29
+ defaultLeaseTTL = 30 * time.Second
30
defaultRenewBefore = 30 * time.Second
31
defaultReadyTarget = 1
32
defaultHTTPShutdownTimeout = 5 * time.Second