You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/deployment/server.md
+22Lines changed: 22 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -127,6 +127,28 @@ The [`hq journal prune`](cli:hq.journal.prune) command removes all completed job
127
127
128
128
The [`hq journal flush`](cli:hq.journal.flush) command will force the server to flush the journal, so that the latest state of affairs is persisted to disk. It is mainly useful for testing or if you are going to run `hq journal export` while a server is running (however, it is usually better to use `hq journal stream`).
129
129
130
+
## Waiting for server availability
131
+
132
+
If you need to wait for a server to become available (for example when coordinating server startup in scripts),
133
+
you can use the [`hq server wait`](cli:hq.server.wait) command:
134
+
135
+
```bash
136
+
$ hq server wait
137
+
```
138
+
139
+
This command will repeatedly attempt to connect to the server (every 5 seconds) until it succeeds or until a timeout
140
+
is reached. By default, it will wait for up to 5 minutes, but you can specify a custom timeout[^1]:
141
+
142
+
```bash
143
+
# Wait for up to 2 minutes
144
+
$ hq server wait --timeout 2m
145
+
```
146
+
147
+
[^1]: You can use various [shortcuts](../cli/shortcuts.md#duration) for the timeout duration.
148
+
149
+
This is particularly useful in deployment scripts where you start a server and then need to ensure it's ready before
150
+
proceeding with other operations like connecting workers or submitting jobs.
151
+
130
152
## Stopping the server
131
153
132
154
You can stop a running server with the [`hq server stop`](cli:hq.server.stop) command:
0 commit comments