Skip to content

Commit

Permalink
add :open_timeout to docs and setup command
Browse files Browse the repository at this point in the history
  • Loading branch information
Robb Kidd committed Jun 1, 2024
1 parent a965924 commit d2ee2cc
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 9 deletions.
27 changes: 24 additions & 3 deletions docs/gemstash-configuration.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ gemstash-configuration
:bind: tcp://0.0.0.0:4242
:protected_fetch: true
:fetch_timeout: 10
:open_timeout: 2
:log_file: gemstash.log
```
Expand Down Expand Up @@ -219,9 +220,11 @@ Boolean values `true` or `false`

`:fetch_timeout`

The timeout setting for fetching gems. Fetching gems over a slow
connection may cause timeout errors. If you experience timeout errors,
you may want to increase this value. The default is `20` seconds.
This is the number of seconds to allow for fetching a gem from upstream.
It covers establishing the connection and receiving the response. Fetching
gems over a slow connection may cause timeout errors. If you experience
timeout errors, you may want to increase this value. The default is `20`
seconds.

## Default value

Expand All @@ -231,6 +234,24 @@ you may want to increase this value. The default is `20` seconds.

Integer value with a minimum of `1`

# Open Timeout

`:open_timeout`

The timeout setting for opening the connection to an upstream gem
server. On high-latency networks, even establishing the connection
to an upstream gem server can take a while. If you experience
connection failures instead of timeout errors, you may want to
increase this value. The default is `2` seconds.

## Default value

`2`

## Valid values

Integer value with a minimum of `1`

# Log File

`:log_file`
Expand Down
10 changes: 10 additions & 0 deletions docs/gemstash-customize.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,16 @@ configuration key to change it.
:fetch_timeout: 20
```

## Open Timeout

The default connection open timeout is 2 seconds. Use the
`:open_timeout` configuration key to change it.

``` yaml
---
:open_timeout: 2
```

## Config File Location

By default, configuration for Gemstash will be at
Expand Down
14 changes: 11 additions & 3 deletions lib/gemstash/cli/setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ def run
ask_cache
ask_database
ask_protected_fetch
ask_timeout
ask_fetch_timeout
ask_open_timeout
check_cache
check_storage
check_database
Expand Down Expand Up @@ -123,13 +124,20 @@ def ask_protected_fetch
@config[:protected_fetch] = value
end

def ask_timeout
def ask_fetch_timeout
say_current_config(:fetch_timeout, "Fetch timeout")
timeout = @cli.ask "How many seconds to wait when fetching a gem? [20]"
timeout = @cli.ask "How many seconds to wait for fetching a gem to complete? [20]"
timeout = Gemstash::Configuration::DEFAULTS[:fetch_timeout] if timeout.to_i < 1
@config[:fetch_timeout] = timeout.to_i
end

def ask_open_timeout
say_current_config(:open_timeout, "Open timeout")
timeout = @cli.ask "How many seconds to wait for connection to upstream gem server to be established? [2]"
timeout = Gemstash::Configuration::DEFAULTS[:open_timeout] if timeout.to_i < 1
@config[:open_timeout] = timeout.to_i
end

def check_cache
try("cache") { gemstash_env.cache_client.alive! }
end
Expand Down
27 changes: 24 additions & 3 deletions man/gemstash-configuration.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ gemstash-configuration
:bind: tcp://0.0.0.0:4242
:protected_fetch: true
:fetch_timeout: 10
:open_timeout: 2
:log_file: gemstash.log
```

Expand Down Expand Up @@ -212,9 +213,11 @@ Boolean values `true` or `false`

`:fetch_timeout`

The timeout setting for fetching gems. Fetching gems over a slow connection may
cause timeout errors. If you experience timeout errors, you may want to increase
this value. The default is `20` seconds.
This is the number of seconds to allow for fetching a gem from upstream.
It covers establishing the connection and receiving the response. Fetching
gems over a slow connection may cause timeout errors. If you experience
timeout errors, you may want to increase this value. The default is `20`
seconds.

## Default value

Expand All @@ -224,6 +227,24 @@ this value. The default is `20` seconds.

Integer value with a minimum of `1`

# Open Timeout

`:open_timeout`

The timeout setting for opening the connection to an upstream gem
server. On high-latency networks, even establishing the connection
to an upstream gem server can take a while. If you experience
connection failures instead of timeout errors, you may want to
increase this value. The default is `2` seconds.

## Default value

`2`

## Valid values

Integer value with a minimum of `1`

# Log File

`:log_file`
Expand Down
10 changes: 10 additions & 0 deletions man/gemstash-customize.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,16 @@ key to change it.
:fetch_timeout: 20
```

## Open Timeout

The default connection open timeout is 2 seconds. Use the
`:open_timeout` configuration key to change it.

``` yaml
---
:open_timeout: 2
```

## Config File Location

By default, configuration for Gemstash will be at `~/.gemstash/config.yml`. This
Expand Down

0 comments on commit d2ee2cc

Please sign in to comment.