Skip to content

Commit 7e5f580

Browse files
authored
Add AUTOPAUSE_STATUS_RETRY_LIMIT and AUTOPAUSE_STATUS_RETRY_INTERVAL (#3365)
1 parent 777f4e2 commit 7e5f580

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

docs/misc/autopause-autostop/autopause.md

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ The following environment variables define the behaviour of auto-pausing:
3838
describes period of the daemonized state machine, that handles the pausing of the process (resuming is done independently)
3939
- `AUTOPAUSE_KNOCK_INTERFACE`, default `eth0`
4040
<br>Describes the interface passed to the `knockd` daemon. If the default interface does not work, run the `ifconfig` command inside the container and derive the interface receiving the incoming connection from its output. The passed interface must exist inside the container. Using the loopback interface (`lo`) does likely not yield the desired results.
41+
- `AUTOPAUSE_STATUS_RETRY_LIMIT`, default 10
42+
- `AUTOPAUSE_STATUS_RETRY_INTERVAL`, default 2s
4143

4244
!!! tip
4345

docs/misc/autopause-autostop/autostop.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@ Enable the Autostop functionality by setting:
1717
```
1818

1919
The following environment variables define the behavior of auto-stopping:
20-
* `AUTOSTOP_TIMEOUT_EST`, default `3600` (seconds)
20+
- `AUTOSTOP_TIMEOUT_EST`, default `3600` (seconds)
2121
describes the time between the last client disconnect and the stopping of the server (read as timeout established)
22-
* `AUTOSTOP_TIMEOUT_INIT`, default `1800` (seconds)
22+
- `AUTOSTOP_TIMEOUT_INIT`, default `1800` (seconds)
2323
describes the time between server start and the stopping of the server, when no client connects in-between (read as timeout initialized)
24-
* `AUTOSTOP_PERIOD`, default `10` (seconds)
24+
- `AUTOSTOP_PERIOD`, default `10` (seconds)
2525
describes period of the daemonized state machine, that handles the stopping of the server
26+
- `AUTOPAUSE_STATUS_RETRY_LIMIT`, default 10
27+
- `AUTOPAUSE_STATUS_RETRY_INTERVAL`, default 2s
2628

2729
> To troubleshoot, add `DEBUG_AUTOSTOP=true` to see additional output
2830

examples/autopause/compose.yml

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ services:
1313
# More aggressive settings for demo purposes
1414
AUTOPAUSE_TIMEOUT_INIT: "30"
1515
AUTOPAUSE_TIMEOUT_EST: "10"
16+
JVM_DD_OPTS: "disable.watchdog:true"
1617
restart: unless-stopped
1718

1819
volumes:

files/auto/autopause-fcns.sh

+6-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,12 @@ mc_server_listening() {
3737
java_clients_connections() {
3838
local connections
3939
if java_running; then
40-
if ! connections=$(mc-monitor status $(use_proxy) --host "${SERVER_HOST:-localhost}" --port "$SERVER_PORT" $(use_server_list_ping) --show-player-count); then
40+
if ! connections=$(mc-monitor status \
41+
--host "${SERVER_HOST:-localhost}" \
42+
--port "$SERVER_PORT" \
43+
--retry-limit "${AUTOPAUSE_STATUS_RETRY_LIMIT:-10}" --retry-interval "${AUTOPAUSE_STATUS_RETRY_INTERVAL:-2s}" \
44+
$(use_proxy) $(use_server_list_ping) \
45+
--show-player-count); then
4146
# consider it a non-zero player count if the ping fails
4247
# otherwise a laggy server with players connected could get paused
4348
connections=1

0 commit comments

Comments
 (0)