mirror of
https://github.com/serverless/serverless.git
synced 2026-01-18 14:58:43 +00:00
1.8 KiB
1.8 KiB
Read this on the main serverless docs site
Schedule
This event allows you to set up scheduled invocations of your function.
The plugin automatically configures a trigger and rule to connect your function to the trigger feed from the alarm package.
Configuration
The schedule event configuration is controlled by a string, based on the UNIX
crontab syntax, in the format cron(X X X X X). This can either be passed in
as a native string or through the rate parameter.
Simple
The following config will attach a schedule event and causes the function crawl to be called every minute.
functions:
crawl:
handler: crawl
events:
- schedule: cron(* * * * *) // run every minute
This automatically generates a new trigger (``${service}_crawl_schedule_trigger) and rule (${service}_crawl_schedule_rule`) during deployment.
Customise Parameters
Other schedule event parameters can be manually configured, e.g trigger or rule names.
functions:
aggregate:
handler: statistics.handler
events:
- schedule:
rate: cron(0 * * * *) // call once an hour
trigger: triggerName
rule: ruleName
max: 10000 // max invocations, default: 1000, max: 10000
params: // event params for invocation
hello: world