"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.REGION = void 0; const v2_1 = require("firebase-functions/v2"); /** * Global 2nd-gen options for every v2 function in this codebase. * * region: pinned to us-central1 — the Android client calls FirebaseFunctions.getInstance() with * no region override (di/SecurityModule.kt, data/remote/FirestoreAnswerDataSource.kt), so the * callables MUST live in us-central1 or every install breaks. Do not change without also * pinning the client. * maxInstances: a runaway-bill guardrail AND a Cloud Run quota constraint. Each 2nd-gen function * is a Cloud Run service, and the project's regional "total CPU allocation" quota is charged as * the SUM of (maxInstances x vCPU) across every function. With ~34 v2 functions and a new * project's default quota (~560 vCPU in us-central1), this must stay low or deploys fail with * "Quota exceeded for total allowable CPU per project per region". 5 x 34 = 170, well under. * For production: request a Cloud Run CPU quota increase (console → IAM & Admin → Quotas) and * raise this. ~80 concurrent requests per instance means 5 instances still serves ~400 in flight. * * cpu 'gcf_gen1' + concurrency 1: v2 defaults every instance to a FULL vCPU (required for the * default concurrency of 80). On this project's default Cloud Run CPU quota that made deploys * fail their container healthchecks ("Quota exceeded for total allowable CPU"). gcf_gen1 uses * the gen1 fractional tiers (256MiB → 1/6 vCPU, 512MiB → 1/3) — a 6x smaller CPU footprint, * which is exactly how these workloads ran on gen1 until now. Concurrency must be 1 when * cpu < 1; at dev scale that costs nothing. AT LAUNCH: request the Cloud Run CPU quota * increase, then delete these two lines to restore 1 vCPU + concurrency 80. * * This module is imported FIRST in index.ts so these options are set before any v2 function is * defined. It has no effect on the one v1 holdout (onUserDelete), which keeps its own defaults. */ (0, v2_1.setGlobalOptions)({ region: 'us-central1', maxInstances: 5, cpu: 'gcf_gen1', concurrency: 1 }); /** Region constant for any per-function override that ever needs to pin it explicitly. */ exports.REGION = 'us-central1'; //# sourceMappingURL=options.js.map