Workers - cronjob - scheduled event: possible to get colo information of scheduled event?

Hi, i would like to periodically request some data from an endpoint/server as a more nouanced health-check. Request duration is of importance, however the response time varies quite a bit (i suspect because the cron is run in different datacenters) Now i would like to know if it is possible to get the current location/datacenter, so that i see if it is my api that has a slow response time, or simply the request being made from far away. I also thought about calling another worker from the cron worker, which does multiple requests to the api, and enable smart placement so that it gets positioned near my api. (there i should get the colo information, as it is not a cron trigger?) Is there anything you think that is for/against doing this?
2 Replies
zegevlier
zegevlier•14mo ago
The easiers way would be to fetch "https://cloudflare.com/cdn-cgi/trace" and parse out the colo field. Taht will save you another workers request
tobi
tobiOP•14mo ago
ah, true story. thank you, ill try that :9 haha 😄 i just did that, and it literally runs my cronjob from somewhere in florida 😄 i will try to do it with a worker that has smart placement enabled 😄
Want results from more Discord servers?
Add your server