From 807bc303919f905456a4340c6eb9cdec1233fccf Mon Sep 17 00:00:00 2001 From: Adam Ross Date: Thu, 18 Apr 2019 05:40:19 -0700 Subject: [PATCH] functions/tips: add run region tags (#1254) --- functions/tips/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/functions/tips/index.js b/functions/tips/index.js index 70a90713a4..3c4159ce0f 100644 --- a/functions/tips/index.js +++ b/functions/tips/index.js @@ -30,6 +30,7 @@ const functionSpecificComputation = heavyComputation; const fileWideComputation = lightComputation; // [START functions_tips_scopes] +// [START run_tips_global_scope] // Global (instance-wide) scope // This computation runs at instance cold-start const instanceVar = heavyComputation(); @@ -47,9 +48,11 @@ exports.scopeDemo = (req, res) => { res.send(`Per instance: ${instanceVar}, per function: ${functionVar}`); }; +// [END run_tips_global_scope] // [END functions_tips_scopes] // [START functions_tips_lazy_globals] +// [START run_tips_global_lazy] // Always initialized (at cold-start) const nonLazyGlobal = fileWideComputation(); @@ -68,6 +71,7 @@ exports.lazyGlobals = (req, res) => { res.send(`Lazy global: ${lazyGlobal}, non-lazy global: ${nonLazyGlobal}`); }; +// [END run_tips_global_lazy] // [END functions_tips_lazy_globals] // [START functions_tips_connection_pooling]