https://discord.cloudflare.com logo
Join Discord
Powered by
# durable-objects
  • f

    faraday

    05/18/2023, 8:48 AM
    how do i detect where durableobject is located ?
  • h

    HardAtWork

    05/18/2023, 9:06 AM
    Here's what I do. Note that this relies on functionality that isn't guaranteed, and thus may cease to function in the future.
    Copy code
    ts
    ((
      await (await fetch("https://www.cloudflare.com/cdn-cgi/trace")).text()
    ).match(/^colo=(.+)/m) as string[])[1]
  • f

    faraday

    05/18/2023, 9:07 AM
    should this be executed inside of durable object?
  • h

    HardAtWork

    05/18/2023, 9:07 AM
    Yes
  • f

    faraday

    05/18/2023, 9:07 AM
    thanks i will have a try
  • f

    faraday

    05/18/2023, 9:08 AM
    i've got AMS is it amsterdam
  • h

    HardAtWork

    05/18/2023, 9:09 AM
    Yes
  • f

    faraday

    05/18/2023, 9:09 AM
    how do i know which regions support durable objects?
  • f

    faraday

    05/18/2023, 9:09 AM
    because my db is in frankfurt
  • f

    faraday

    05/18/2023, 9:09 AM
    FRA
  • h

    HardAtWork

    05/18/2023, 9:10 AM
    Here is the DO Spawn statistics for *Frankfurt(FRA)*:
    Copy code
    39.89% Amsterdam (AMS), 60.11% Frankfurt (FRA)
  • h

    HardAtWork

    05/18/2023, 9:10 AM
    So it looks like it is working fine
  • h

    HardAtWork

    05/18/2023, 9:10 AM
    Or well
  • h

    HardAtWork

    05/18/2023, 9:10 AM
    The colo matches
  • f

    faraday

    05/18/2023, 9:10 AM
    okay so if i want to reset creation i just need to change id?
  • h

    HardAtWork

    05/18/2023, 9:11 AM
    Yes. Though note that this still won't guarantee being spawned in FRA, just that there is a 60.11% chance that it will
  • f

    faraday

    05/18/2023, 9:12 AM
    it worked thanks
  • f

    faraday

    05/18/2023, 9:13 AM

    https://cdn.discordapp.com/attachments/773219443911819284/1108683723894960148/Screenshot_2023-05-18_at_17.12.36.png▾

  • f

    faraday

    05/18/2023, 9:13 AM
    it looks fine but i don't get what LAX in cf-ray means
  • h

    HardAtWork

    05/18/2023, 9:14 AM
    That means that your request entered the CF network from the *Los Angeles(LAX)* colo, and was subsequently routed to FRA.
  • f

    faraday

    05/18/2023, 9:15 AM
    but how it that possible
  • h

    HardAtWork

    05/18/2023, 9:15 AM
    I assume your ISP connects to the open internet somewhere near Los Angeles?
  • f

    faraday

    05/18/2023, 9:15 AM
    nah i'm from china but i use vpn that proxies me through Taiwan and accually it's correct in logs
  • f

    faraday

    05/18/2023, 9:16 AM

    https://cdn.discordapp.com/attachments/773219443911819284/1108684474914451566/Screenshot_2023-05-18_at_17.16.07.png▾

  • f

    faraday

    05/18/2023, 9:16 AM
    i don't know why it displays LAX in ray
  • h

    HardAtWork

    05/18/2023, 9:17 AM
    Might be a Taiwan ISP that happens to peer in LAX. BGP is weird sometimes.
  • h

    HardAtWork

    05/18/2023, 9:17 AM
    ?anycast
  • h

    Helpflare

    05/18/2023, 9:17 AM
    Take a look here to see why the Cloudflare datacenter you are routed towards isn't always the closest geographically: https://community.cloudflare.com/t/peering-why-dont-i-reach-the-closest-datacenter-to-me/76479
  • f

    faraday

    05/18/2023, 9:21 AM
    i will try to change vpn server and let's see the difference
  • y

    Yaron

    05/18/2023, 12:55 PM
    I am trying to build a helpful twitter bot, and wondering if a durable object is the right tool for the job The bot will poll twitter every second, looking to see if it mentioned. If it is - it will send some backend request and post the result. The durable object will have to poll twitter every second, and manage which mentions were already answered or waiting for BE response I was also considering to use workers with cron and r2, or to just develop a standalone node server. What do you think? Any caveats I should expect with durable worker?
1...558559560...567Latest