Skip to content

Commit

Permalink
Merge pull request #3 from kustom-dev/add-cron-trigger
Browse files Browse the repository at this point in the history
Update wrangler.toml with cron trigger & fix README
  • Loading branch information
drew-patel authored Sep 7, 2024
2 parents d394083 + 0df9263 commit 9e8677a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This repository contains a Cloudflare worker which runs on a schedule (every 60
- Copy `sample.dev.vars` to `.dev.vars`
- Add your WorkOS credentials to the `.dev.vars` file
- Run with `pnpm run dev`
- In another terminal tab run `http://localhost:8787/__scheduled`
- In another terminal tab run `curl 'http://localhost:8787/__scheduled?cron=*+*+*+*+*'`
- The default behavior for the development environment is to request events in the last 60 seconds from the WorkOS Events API
- You can modify this behavior by adding `EVENTS_RANGE_START` and/or `EVENTS_RANGE_END` to `.dev.vars` to fetch events within a given time range. Both env vars need to be a Unix Timestamp in Milliseconds
- See the [Testing](#testing) section for how to generate and test events within a specific time range
Expand Down
4 changes: 4 additions & 0 deletions wrangler.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ main = "src/index.ts"
compatibility_date = "2024-09-03"
compatibility_flags = ["nodejs_compat"]

[triggers]
# Runs every minute
crons = ["* * * * *"]

# Automatically place your workloads in an optimal location to minimize latency.
# If you are running back-end logic in a Worker, running it closer to your back-end infrastructure
# rather than the end user may result in better performance.
Expand Down

0 comments on commit 9e8677a

Please sign in to comment.