From 10879cebcc2e6ea9bd1a7953184f40e740aec52a Mon Sep 17 00:00:00 2001 From: Zeke Gabrielse Date: Sat, 21 Dec 2024 10:11:52 -0600 Subject: [PATCH] update default ttl --- README.md | 6 +++--- internal/cmd/serve.go | 2 +- internal/server/config.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c9c4b3a..fc9c74a 100644 --- a/README.md +++ b/README.md @@ -159,9 +159,9 @@ The `serve` command supports the following flags: | Flag | Description | Default | |:---------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------------| | `--port`, `-p` | Specifies the port on which the relay server will run. | `6349` | -| `--no-heartbeats` | Disables the heartbeat system. When this flag is enabled, the server will not automatically release inactive or dead nodes, and leases cannot be extended. | `false` | -| `--strategy` | Specifies the license distribution strategy. Options: `fifo`, `lifo`, `rand`. | `fifo` | -| `--ttl`, `-t` | Sets the time-to-live for leases. Licenses will be automatically released after the time-to-live if a node heartbeat is not maintained. Options: e.g. `30s`, `1m`, `1h`, etc. | `30s` | +| `--no-heartbeats` | Disables the heartbeat system. When this flag is enabled, the server will not automatically release inactive or dead nodes, and leases cannot be extended. | `false` | +| `--strategy` | Specifies the license distribution strategy. Options: `fifo`, `lifo`, `rand`. | `fifo` | +| `--ttl`, `-t` | Sets the time-to-live for leases. Licenses will be automatically released after the time-to-live if a node heartbeat is not maintained. Options: e.g. `30s`, `1m`, `1h`, etc. | `60s` | | `--cull-interval` | Specifies how often the server should check for and deactivate inactive or dead nodes. | `15s` | | `--database` | Specify a custom database file for storing the license and node data. | `./relay.sqlite` | diff --git a/internal/cmd/serve.go b/internal/cmd/serve.go index 00817d3..16650cf 100644 --- a/internal/cmd/serve.go +++ b/internal/cmd/serve.go @@ -71,7 +71,7 @@ func ServeCmd(srv server.Server) *cobra.Command { cmd.Flags().StringVarP(&cfg.ServerAddr, "bind", "b", try.Try(try.Env("RELAY_ADDR"), try.Env("BIND_ADDR"), try.Static(cfg.ServerAddr)), "ip address to bind the relay server to [$RELAY_ADDR=0.0.0.0]") cmd.Flags().IntVarP(&cfg.ServerPort, "port", "p", try.Try(try.EnvInt("RELAY_PORT"), try.EnvInt("PORT"), try.Static(cfg.ServerPort)), "port to run the relay server on [$RELAY_PORT=6349]") - cmd.Flags().DurationVar(&cfg.TTL, "ttl", try.Try(try.EnvDuration("RELAY_LEASE_TTL"), try.Static(cfg.TTL)), "time-to-live for leases [$RELAY_LEASE_TTL=30s]") + cmd.Flags().DurationVar(&cfg.TTL, "ttl", try.Try(try.EnvDuration("RELAY_LEASE_TTL"), try.Static(cfg.TTL)), "time-to-live for leases [$RELAY_LEASE_TTL=60s]") cmd.Flags().Bool("no-heartbeats", try.Try(try.EnvBool("RELAY_NO_HEARTBEATS"), try.Static(false)), "disable node heartbeat monitoring and culling as well as lease extensions [$RELAY_NO_HEARTBEAT=1]") cmd.Flags().Var(&cfg.Strategy, "strategy", `strategy for license distribution e.g. "fifo", "lifo", or "rand" [$RELAY_STRATEGY=rand]`) cmd.Flags().DurationVar(&cfg.CullInterval, "cull-interval", try.Try(try.EnvDuration("RELAY_CULL_INTERVAL"), try.Static(cfg.CullInterval)), "interval at which to cull dead nodes [$RELAY_CULL_INTERVAL=15s]") diff --git a/internal/server/config.go b/internal/server/config.go index 974c8aa..bea05f3 100644 --- a/internal/server/config.go +++ b/internal/server/config.go @@ -51,7 +51,7 @@ func NewConfig() *Config { return &Config{ ServerAddr: "0.0.0.0", ServerPort: 6349, - TTL: 30 * time.Second, + TTL: 1 * time.Minute, EnabledHeartbeat: true, Strategy: FIFO, CullInterval: 15 * time.Second,