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

    arguiot

    11/22/2022, 10:17 PM
    AppSync would be more expensive though
  • a

    arguiot

    11/22/2022, 10:17 PM
    But still cheaper
  • u

    Unsmart | Tech debt

    11/22/2022, 10:18 PM
    The sockets themselves dont hold any specific pricing at all. A socket just keeps a durable object active. While a durable object is active it accumulates a duration charge. Even if you have 100 sockets connected to a single object the object doesnt somehow have more active time because many people are connected to it.
  • a

    arguiot

    11/22/2022, 10:18 PM
    ok
  • w

    Wallacy

    11/23/2022, 1:21 AM
    The good part is that you can use the same DO for control more than one room... In this example you can put more rooms per DO. 50 per/do will cost something like 0,27c, But yes, will need at least 500 rooms / DO like that to beat the AppSync.
  • u

    Unsmart | Tech debt

    11/23/2022, 1:24 AM
    Sure you could have more than one room per DO but a DO can only handle so much scale. Pubsub would really be better for chat rooms but pubsub is still in beta and the limits arent up to par yet
  • r

    ruttvikkheni

    11/23/2022, 11:41 AM
    Hello I have one query. Is there is way to create queue inside Durable Object?
  • e

    ehesp

    11/23/2022, 3:26 PM
    @ruttvikkheni yes of sorts - you can store data with a lexically ordered key, and use an alarm to process them
  • e

    ehesp

    11/23/2022, 3:26 PM
    https://github.com/evanderkoogh/do-taskmanager also helps - it's a wrapper around alarms with an interface
  • r

    ruttvikkheni

    11/23/2022, 5:05 PM
    @ehesp I have one worker with web socket pair and I need
    web socket server(pain[1])
    inside queue consumer, so how I can manage DO here? end goal, when consumer queue finish execution at that time I need to send message using
    web socket server(pain[1])
    .
  • t

    threepointone

    11/23/2022, 5:19 PM
    Folks, do you know whether Durable Objects with live websocket connections will stay active when a new version is published?
  • t

    threepointone

    11/23/2022, 5:19 PM
    I believe they do, but double checking
  • j

    jed

    11/23/2022, 6:15 PM
    my understanding is the opposite (see https://github.com/cloudflare/miniflare/issues/178 for example), but not sure.
  • j

    jed

    11/23/2022, 6:19 PM
    sockets are definitely closed when a DO eviction occurs, fwiw: https://discord.com/channels/595317990191398933/773219443911819284/930976111310032937
  • t

    thebatt

    11/23/2022, 9:06 PM
    Does anyone know why one of my DOs is getting persistent storage wiped when publishing updates from wrangler, while other DO class's objects are maintaining their state.storage across deployments?
  • t

    threepointone

    11/23/2022, 9:13 PM
    Appreciate this, thank you!
  • j

    Jacob Wright

    11/24/2022, 2:23 AM
    Something that I didn’t know before trial and error is using Wrangler dev will load the existing data of live DOs and any storage changes are made on top of it. When dev resets, the data resets back to what is live. I don’t know if this could be your issue since you didn’t mention you were in dev mode, but it threw me.
  • d

    Dio

    11/24/2022, 6:00 AM
    Can you tell me how long sessions are stored in this object? How much data can I store here at most? I just want to store chat information (chat type, user data, etc) here
  • h

    HardAtWork

    11/24/2022, 8:30 AM
    Any variable that is part of your Durable Object exists as long as it is alive(may be 30 seconds, may be an hour, may be more). You have the standard 128 mb memory limit to contend with, although note that this includes all of the data in your DO, not just
    this.sessions
    .
  • d

    Dio

    11/24/2022, 8:32 AM
    thanks!
  • r

    raRaRa

    11/24/2022, 12:31 PM
    Please also note that your DO may get destroyed at any time, e.g. when the CF team is updating the runtime behind it.
  • r

    raRaRa

    11/24/2022, 12:32 PM
    So you may want to store the data externally from your DO, in cache, etc.
  • t

    thebatt

    11/24/2022, 1:00 PM
    I am not in dev mode that I know of, however my DO is called [worker]_production_[ClassName] and is taking no hits in the metrics, so I suspect I am accessing this DO in dev environment. How did this happen, when it's not the case for my other DO on the same Worker?
  • r

    rennokki

    11/24/2022, 4:12 PM
    Hi @kenton and #773219443911819284, one of my clients using DO happened to see this issure pop out again. Read messages for context and see if you can replicate it again: https://discord.com/channels/595317990191398933/773219443911819284/931230846017470474
  • r

    rennokki

    11/24/2022, 4:13 PM
    It seems like the timeout is now 3-4 minutes instead of the initial time.
  • r

    rennokki

    11/24/2022, 4:13 PM
    The DOs are evicted even with client events.
  • t

    thebatt

    11/24/2022, 4:19 PM
    Except when DO code is deployed, they are force evicted, correct?
  • r

    rennokki

    11/24/2022, 8:56 PM
    Haven't tested it yet. The WS connection is made, the DO gets called once, then after 3 minutes the DO is gone.
  • e

    Erwin

    11/24/2022, 9:40 PM
    Are you not sending any messages over that connection in those 3 minutes?
  • r

    rennokki

    11/24/2022, 10:07 PM
    Just the WS connection sends pings and receives pongs, but no DO invocation is done in the meanwhile.
1...445446447...567Latest