@rip-lang/server 0.8.2 → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/package.json +1 -1
- package/server.rip +3 -8
package/README.md
CHANGED
|
@@ -424,8 +424,8 @@ Most settings are configured via CLI flags, but environment variables provide an
|
|
|
424
424
|
| `RIP_MAX_REQUESTS` | `r:N,...` | `10000` | Max requests before worker recycle |
|
|
425
425
|
| `RIP_MAX_SECONDS` | `r:...,Ns` | `3600` | Max seconds before worker recycle |
|
|
426
426
|
| `RIP_MAX_QUEUE` | `--max-queue=` | `512` | Request queue limit |
|
|
427
|
-
| `RIP_QUEUE_TIMEOUT_MS` | `--queue-timeout-ms=` | `
|
|
428
|
-
| `RIP_CONNECT_TIMEOUT_MS` | `--connect-timeout-ms=` | `
|
|
427
|
+
| `RIP_QUEUE_TIMEOUT_MS` | `--queue-timeout-ms=` | `30000` | Queue wait timeout (ms) |
|
|
428
|
+
| `RIP_CONNECT_TIMEOUT_MS` | `--connect-timeout-ms=` | `2000` | Reserved for future use |
|
|
429
429
|
| `RIP_READ_TIMEOUT_MS` | `--read-timeout-ms=` | `30000` | Worker read timeout (ms) |
|
|
430
430
|
|
|
431
431
|
## Dashboard
|
package/package.json
CHANGED
package/server.rip
CHANGED
|
@@ -340,8 +340,8 @@ parseFlags = (argv) ->
|
|
|
340
340
|
reload
|
|
341
341
|
socketPrefix
|
|
342
342
|
maxQueue: coerceInt(getKV('--max-queue='), coerceInt(process.env.RIP_MAX_QUEUE, 512))
|
|
343
|
-
queueTimeoutMs: coerceInt(getKV('--queue-timeout-ms='), coerceInt(process.env.RIP_QUEUE_TIMEOUT_MS,
|
|
344
|
-
connectTimeoutMs: coerceInt(getKV('--connect-timeout-ms='), coerceInt(process.env.RIP_CONNECT_TIMEOUT_MS,
|
|
343
|
+
queueTimeoutMs: coerceInt(getKV('--queue-timeout-ms='), coerceInt(process.env.RIP_QUEUE_TIMEOUT_MS, 30000))
|
|
344
|
+
connectTimeoutMs: coerceInt(getKV('--connect-timeout-ms='), coerceInt(process.env.RIP_CONNECT_TIMEOUT_MS, 2000))
|
|
345
345
|
readTimeoutMs: coerceInt(getKV('--read-timeout-ms='), coerceInt(process.env.RIP_READ_TIMEOUT_MS, 30000))
|
|
346
346
|
jsonLogging: has('--json-logging')
|
|
347
347
|
accessLog: not has('--no-access-log')
|
|
@@ -876,20 +876,15 @@ class Server
|
|
|
876
876
|
forwardOnce: (req, socketPath) ->
|
|
877
877
|
inUrl = new URL(req.url)
|
|
878
878
|
forwardUrl = "http://localhost#{inUrl.pathname}#{inUrl.search}"
|
|
879
|
-
controller = new AbortController()
|
|
880
|
-
connectTimer = setTimeout (-> controller.abort()), @flags.connectTimeoutMs
|
|
881
879
|
readTimeoutMs = @flags.readTimeoutMs
|
|
882
880
|
|
|
883
881
|
try
|
|
884
|
-
|
|
885
|
-
fetchPromise = fetch(forwardUrl, { method: req.method, headers: req.headers, body: req.body, unix: socketPath, signal: controller.signal })
|
|
882
|
+
fetchPromise = fetch(forwardUrl, { method: req.method, headers: req.headers, body: req.body, unix: socketPath })
|
|
886
883
|
readGuard = new Promise (_, rej) ->
|
|
887
884
|
setTimeout (-> rej(new Error('Upstream timeout'))), readTimeoutMs
|
|
888
885
|
res = Promise.race!([fetchPromise, readGuard])
|
|
889
|
-
clearTimeout(connectTimer)
|
|
890
886
|
res
|
|
891
887
|
catch err
|
|
892
|
-
clearTimeout(connectTimer)
|
|
893
888
|
if err.message is 'Upstream timeout'
|
|
894
889
|
return new Response('Gateway timeout', { status: 504 })
|
|
895
890
|
throw err
|