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

    Vanessa🦩

    06/10/2021, 12:07 AM
    Ah yes if you do not have a paid zone then requests will be routed to cheaper locations.
  • j

    jed

    06/10/2021, 12:10 AM
    this is true for the originating worker, but is it also true for the DO?
  • v

    Vanessa🦩

    06/10/2021, 12:18 AM
    As I understand it, it’s only about which location handles the initial request to your domain name. And some locations do not host DOs yet but that’s independent of your plan.
  • j

    jed

    06/10/2021, 12:23 AM
    right, but if that's the case why do I see PoPs like KIX? it does support DOs but still sends half of its objects to PRG.
  • v

    Vanessa🦩

    06/10/2021, 12:25 AM
    That sounds weird indeed.
  • j

    jed

    06/10/2021, 12:26 AM
    @User, would love to get some clarity here. half of my DOs originating from KIX are created in KIX, and the other half end up 8,920 km away in PRG.
  • z

    zifera

    06/10/2021, 9:52 AM
    Does any one have an example of using list() with Durable Objects?
  • z

    zifera

    06/10/2021, 9:52 AM
    I cant seem to get it to work
  • z

    zifera

    06/10/2021, 9:53 AM
    const list = await env.PAGEVIEWS.list({ prefix: 'type:pageviews:domain:test.nl' })
  • z

    zifera

    06/10/2021, 9:53 AM
    TypeError: env.PAGEVIEWS.list is not a functio
  • z

    zifera

    06/10/2021, 9:56 AM
    Oh you have to use it on this.storage
  • m

    MrHalzy

    06/10/2021, 12:19 PM
    Afaik, listing DOs isn't a thing yet
  • m

    MrHalzy

    06/10/2021, 12:20 PM
    I asked a week back and they said it's in the works.
  • b

    brett

    06/10/2021, 1:22 PM
    Correct, you can list items inside a DO's storage, but you cannot list DO ids themselves (yet)
  • w

    Webber

    06/10/2021, 3:04 PM
    I found that durable objects can be used together with websockets. I also read that max execution time of a worker is 10ms or 30s. I don't suppose all websocket connections need to reconnect every 30 seconds but I also didn't find out how it does work. Could someone please help me understand?
  • m

    matt

    06/10/2021, 4:06 PM
    @User I gave a shot at reproducing the websocket behavior you had mentioned a few days ago, and I wasn't able to send an event on a websocket after receiving the disconnection error caused by code updates. If you have a code sample that reproduces it, that'd be pretty helpful.
  • m

    matt

    06/10/2021, 4:07 PM
    Note that disconnection of actor storage on the old instance after code updates made it into this week's runtime release
  • m

    Mallissin

    06/10/2021, 4:12 PM
    Does this mean code updates clears DO storage?
  • v

    Vanessa🦩

    06/10/2021, 4:13 PM
    I don't have a code sample, and I also have not seen that error anymore, but I haven't actively tried to reproduce.
  • m

    matt

    06/10/2021, 4:13 PM
    So it should be impossible now to observe side effects from the old instance unless websocket disconnection on code updates has a bug, or playing tricks with long-polling HTTP requests (Which currently we don't immediately disconnect as it might not be safe for all applications to do so).
  • v

    Vanessa🦩

    06/10/2021, 4:14 PM
    Right. That's how it should be.
  • v

    Vanessa🦩

    06/10/2021, 4:15 PM
    ... and the way I'm handling it now (closing all sockets so client reconnects) sounds like the right action.
  • v

    Vanessa🦩

    06/10/2021, 4:16 PM
    (I'm pattern-matching on
    "send a new request"
    in the error message)
  • m

    matt

    06/10/2021, 4:17 PM
    No, this is referring to the short period of time after a code update when there are two instances for a single durable object (we have to allow existing http requests to the updated durable object to finish up). Before this week's runtime release, that old instance could still access the DO storage API, which could lead to correctness bugs. Now, attempts to access storage from the old instance will fail
  • m

    Mallissin

    06/10/2021, 4:18 PM
    Whew. Ok, that makes sense.
  • m

    matt

    06/10/2021, 4:18 PM
    The runtime should be disconnecting for you (It's a hard disconnection, without a close frame being sent)
  • m

    matt

    06/10/2021, 4:18 PM
    If you're actually able to send a close frame in response to that error, that's a bug! (our bug, to be clear)
  • v

    Vanessa🦩

    06/10/2021, 4:21 PM
    Ah, even better. So you will disconnect storage and close all websockets on update.
  • m

    matt

    06/10/2021, 4:23 PM
    yep!
  • b

    brett

    06/10/2021, 4:25 PM
    Durable Objects are a bit unique, and no, you don't have to reconnect every 30 seconds. You could keep a websocket open to a DO for a long period of time. Of course, all code should anticipate disconnects and be prepared to reconnect.
1...9899100...567Latest