diff --git a/apps/demo-tasks/src/index.ts b/apps/demo-tasks/src/index.ts index cac943f..1c71362 100644 --- a/apps/demo-tasks/src/index.ts +++ b/apps/demo-tasks/src/index.ts @@ -9,7 +9,12 @@ import { Container, getContainer } from '@cloudflare/containers'; export class TasksBoard extends Container { defaultPort = 8080; - sleepAfter = '2h'; + // Matched to the gateways rather than left at the 2h it had. The board is + // ephemeral by design and demo jobs run for seconds, so there is no state + // here worth paying to keep warm — and the gateway forwards every tasks + // call, which keeps this awake for exactly as long as anyone is using it. + // A poll that does land on a cold start gets the 503-and-retry below. + sleepAfter = '15m'; enableInternet = false; // it dials nothing; it only answers } diff --git a/apps/demo/src/index.ts b/apps/demo/src/index.ts index 65c7bca..a83beac 100644 --- a/apps/demo/src/index.ts +++ b/apps/demo/src/index.ts @@ -31,12 +31,14 @@ const FOLD_CONFIG = { export class FoldDemo extends Container { defaultPort = 8080; - // This is now the only thing bounding what the container costs. It used to - // be a backstop — the uptime monitor pinged every 5 minutes, so in practice - // the container never slept — but that monitor is undeployed, so an idle - // hour after one visitor is an hour of provisioned memory and disk on the - // bill. Shorten it to trade a ~1.7s cold start for that tail. - sleepAfter = '1h'; + // The only thing bounding what this container costs. It used to be a + // backstop — the uptime monitor pinged every 5 minutes, so in practice the + // container never slept — but that monitor is undeployed, so every idle + // minute after a visitor leaves is provisioned memory and disk on the bill. + // 15m buys the tail back for a ~1.7s cold start on the next visitor, which + // is a fair trade for a demo people arrive at one at a time rather than in + // a steady stream. + sleepAfter = '15m'; enableInternet = true; // fold dials the public upstreams envVars = { FOLD_CONFIG: JSON.stringify(FOLD_CONFIG) }; } diff --git a/apps/enterprise/src/index.ts b/apps/enterprise/src/index.ts index 82afbd1..79dd117 100644 --- a/apps/enterprise/src/index.ts +++ b/apps/enterprise/src/index.ts @@ -199,10 +199,10 @@ const FOLD_CONFIG = { export class FoldEnterprise extends Container { defaultPort = 8080; - // The same billing lever as the demo's, and the same caveat: the uptime - // monitor that used to keep this warm is undeployed, so this timeout alone - // decides how long an idle container stays on the bill. - sleepAfter = '1h'; + // The same billing lever as the demo's, on the same 15m, and with more + // reason to be short: this gateway is behind a sign-in, so it sits idle + // more of the time than the demo does. + sleepAfter = '15m'; enableInternet = true; // fold dials the public upstreams and the issuer's JWKS envVars = { FOLD_CONFIG: JSON.stringify(FOLD_CONFIG) }; }