Skip to content

Commit

Permalink
update default ttl
Browse files Browse the repository at this point in the history
  • Loading branch information
ezekg committed Dec 21, 2024
1 parent 8271b18 commit 10879ce
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` |

Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]")
Expand Down
2 changes: 1 addition & 1 deletion internal/server/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 10879ce

Please sign in to comment.