@risk-labs/serverless-orchestration 1.2.0-alpha.1 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@risk-labs/serverless-orchestration",
3
- "version": "1.2.0-alpha.1",
3
+ "version": "1.3.0",
4
4
  "description": "Serverless orchestration scripts to run a parallel instances of scripts or bots",
5
5
  "engines": {
6
6
  "node": ">=20"
@@ -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.
@@ -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.