Neil Hynes
05/20/2022, 10:04 AMprocess.env.IS_LOCAL
and returning to abort the lambdas, but it’d be even nicer to have the crons not run at all.
Is there a way to add a rule to the cron job definition not to run if process.env.IS_LOCAL
is set?Adrian Schweizer
05/20/2022, 10:22 AMapp.stage
in index.js and if it has a certain value, not deploy the cron stacks at allAdrian Schweizer
05/20/2022, 10:23 AMnew Cron
in such an api.stage
checkAdrian Schweizer
05/20/2022, 10:23 AMAdrian Schweizer
05/20/2022, 10:24 AMRoss Coundon
05/20/2022, 10:26 AMnew sst.Cron(this, 'some-id', {
job: someFunc,
schedule: process.env.CRON_SCHEDULE,
cdk: {
rule: {
enabled: !scope.local, // Need to run via SST console if running locally
},
},
});
Adrian Schweizer
05/20/2022, 10:26 AMAdrian Schweizer
05/20/2022, 10:27 AMapp.local
in the new functional constructs?Ross Coundon
05/20/2022, 10:29 AMctx.app.local
Where ctx is the StackContextAdrian Schweizer
05/20/2022, 10:29 AMNeil Hynes
05/20/2022, 10:30 AMcdk.rule.enabled
might be the piece I’m missing. Thanks so much! 🙂Ross Coundon
05/20/2022, 10:30 AMAdrian Schweizer
05/20/2022, 10:31 AMAdrian Schweizer
05/20/2022, 10:31 AMthdxr
05/20/2022, 12:40 PMthdxr
05/20/2022, 12:40 PMthdxr
05/20/2022, 12:40 PMAdrian Schweizer
05/20/2022, 12:42 PMAdrian Schweizer
05/20/2022, 12:42 PMthdxr
05/20/2022, 12:43 PMAdrian Schweizer
05/20/2022, 12:43 PMthdxr
05/20/2022, 12:43 PMthdxr
05/20/2022, 12:43 PMProvisioned concurrency – Provisioned concurrency initializes a requested number of execution environments so that they are prepared to respond immediately to your function's invocations. Note that configuring provisioned concurrency incurs charges to your AWS account.
Adrian Schweizer
05/20/2022, 12:44 PMAdrian Schweizer
05/20/2022, 12:46 PMAdrian Schweizer
05/20/2022, 12:48 PMthdxr
05/20/2022, 12:52 PMthdxr
05/20/2022, 12:53 PMbun
which is a new js runtime that is way way better at starting upthdxr
05/20/2022, 12:53 PMAdrian Schweizer
05/20/2022, 12:53 PMthdxr
05/20/2022, 12:55 PMFrank
v1.2.0
, we lifted enabled
out of .cdk
for convenience, you can do this now:
new sst.Cron(this, 'cron', {
job,
schedule,
enabled: app.local,
});