zooce
CDCloudflare Developers
•Created by zooce on 6/27/2023 in #workers-help
Locally testing a Worker with both a fetch and a scheduled handler
Hey there,
I have a worker that I want to handle both a
fetch
event and a scheduled
event. Basically I want the scheduled
handler to update a couple of KV stores every so often, while the fetch
handler reads from those KV stores to respond to its requests.
The other thing is that both handlers need to access a service binding to another worker. This means to test things out locally I need to run without the --local
flag (I'm still on wrangler 2 for now), however that seems to mess things up with the --test-scheduled
flag.
Anyone know a way around this? Or perhaps just a better way to do this?1 replies