@risk-labs/serverless-orchestration 1.2.0 → 1.3.0
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/package.json +1 -1
- package/src/ServerlessHub.js +5 -0
- package/src/ServerlessSpoke.js +5 -0
package/package.json
CHANGED
package/src/ServerlessHub.js
CHANGED
|
@@ -100,6 +100,11 @@ const defaultHubConfig = {
|
|
|
100
100
|
|
|
101
101
|
const waitForLoggerDelay = WAIT_FOR_LOGGER_DELAY || 5;
|
|
102
102
|
|
|
103
|
+
// Lightweight liveness/warm-up endpoint. Returns 200 without doing any work. Used by the
|
|
104
|
+
// deploy pipeline to pre-warm Cloud Run instances after a new revision rolls out, so the
|
|
105
|
+
// first POST / from the cron scheduler doesn't pay a cold-start tax.
|
|
106
|
+
hub.get("/health", (_req, res) => res.status(200).send({ ok: true }));
|
|
107
|
+
|
|
103
108
|
hub.post("/", async (req, res) => {
|
|
104
109
|
// Use a custom logger if provided. Otherwise, initialize a local logger.
|
|
105
110
|
// Note: no reason to put this into the try-catch since a logger is required to throw the error.
|
package/src/ServerlessSpoke.js
CHANGED
|
@@ -23,6 +23,11 @@ let customLogger;
|
|
|
23
23
|
|
|
24
24
|
const waitForLoggerDelay = process.env.WAIT_FOR_LOGGER_DELAY || 5;
|
|
25
25
|
|
|
26
|
+
// Lightweight liveness/warm-up endpoint. Returns 200 without doing any work, so the deploy
|
|
27
|
+
// pipeline can issue parallel GETs after `gcloud run deploy` to force Cloud Run to spin up
|
|
28
|
+
// fresh instances before the next hub tick fans out POSTs.
|
|
29
|
+
spoke.get("/health", (_req, res) => res.status(200).send({ ok: true }));
|
|
30
|
+
|
|
26
31
|
spoke.post("/", async (req, res) => {
|
|
27
32
|
// Use a custom logger if provided. Otherwise, initialize a local logger with a run identifier if passed from the Hub.
|
|
28
33
|
// Note: no reason to put this into the try-catch since a logger is required to throw the error.
|