From 0df9263108be9034a59ee7d34b6c855c5728682f Mon Sep 17 00:00:00 2001 From: Drew Patel Date: Fri, 6 Sep 2024 21:15:50 -0600 Subject: [PATCH] Update wrangler.toml with cron trigger & fix README --- README.md | 2 +- wrangler.toml | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3f0c798..2ad1068 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/wrangler.toml b/wrangler.toml index deb7a12..11ce04d 100644 --- a/wrangler.toml +++ b/wrangler.toml @@ -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.