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

    kian

    01/02/2023, 9:00 AM
    As far as I'm aware, 5 request units
  • k

    kian

    01/02/2023, 9:00 AM
  • p

    p0

    01/02/2023, 9:01 AM
    request units?
  • p

    p0

    01/02/2023, 9:01 AM
    oh
  • p

    p0

    01/02/2023, 9:01 AM
    write request units
  • p

    p0

    01/02/2023, 9:01 AM
    I see
  • p

    p0

    01/02/2023, 9:01 AM
    that's not too bad actually
  • p

    p0

    01/02/2023, 9:02 AM
    well
  • p

    p0

    01/02/2023, 9:03 AM
    actually wouldn't that mean it's cheaper to store it as an array and just use one value?
  • a

    aarhus

    01/02/2023, 10:46 AM
    Yes - one write. You can also track whether you are making changes to the any values in a non persisted key so that you only write when changes are made
  • a

    aarhus

    01/02/2023, 10:52 AM
    One of my projects stored everything in 4 keys - each one was an js object about something. It was then serialised and written, if it was too big and exception was thrown and then it was split across multiple keys. The plus side was few keys, the downside was that if you made a small change to an attribute, it would cause all of the different chunks for that key to be written. It's swings and roundabouts as to which works better for your environment.
  • d

    DanTheGoodman

    01/02/2023, 3:54 PM
    correct, just found this today
  • d

    DanTheGoodman

    01/02/2023, 3:56 PM
    I would still do my own bindings so they can't directly access storage and such but I will play with that, praying it works!
  • k

    Kai

    01/02/2023, 3:56 PM
    šŸ‘ I think WASM is fully isolated & if you clear global variables they should have no access to bindings either
  • k

    Kai

    01/02/2023, 3:56 PM
    not sure but I think it should be possible
  • d

    DanTheGoodman

    01/02/2023, 4:10 PM
    Yeah I think that should be perfect!
  • d

    DanTheGoodman

    01/02/2023, 4:10 PM
    will play with it later
  • t

    toinbis

    01/03/2023, 9:53 AM
    Am wondering if I can connect to D1 from durable object? How I would access the D1 binding in DO? Am trying to achieve the scenario described below. https://community.cloudflare.com/t/d1-bindings-in-durable-objects/448646 asked same question, but it was not yet answered. Thanks!
    Copy code
    async alarm() {
      this.broadcast(this.getDataFromD1())
      this.storage.setAlarm(Date.now() + 3 * MSECONDS)
    }
  • r

    ryucode

    01/03/2023, 11:03 AM
    let id = OBJECT_NAMESPACE.newUniqueId();
    -> in durable objects, this unique ID, is it unique per account or across cloudflare?
  • b

    brett

    01/03/2023, 3:14 PM
    It will generate a unique ID that can only be used in that namespace. If another namespace tries to use it, it will throw an error. It should also be globally unique since it's 256 bits of obfuscated data.
  • b

    brett

    01/03/2023, 3:28 PM
    Hmm, DOs are pretty normal workers, I think you'd configure the D1 binding on that Worker in Wrangler the same way you would any other.
  • k

    kian

    01/03/2023, 3:29 PM
    D1 has a shim added into the fetch/etc handlers by Wrangler which isn't done in the Durable Object class
  • k

    kian

    01/03/2023, 3:29 PM
    It's a weird one - but you can DIY it https://discord.com/channels/595317990191398933/992060581832032316/1059778299435425902
  • b

    brett

    01/03/2023, 3:40 PM
    Ah sorry, have never used it myself.
  • j

    João Castro

    01/04/2023, 3:30 PM
    Hi! Do you have any updates about Durable Objects instances in South America? I'm building something for Brazilian users, and the latency might be an issue 🫤.
  • k

    Kevin W - Itty

    01/04/2023, 3:45 PM
    So for sockets with a DO (from a Worker). As long as a requesting party (e.g. browser) sends a GET/upgrade request to the Worker, does it matter what headers/method is sent to the DO as long as it responds with a socket client (and the Worker responds appropriately)? As in, does the DO actually care about any of the normal socket requesting protocols, since it's only a middle layer?
  • k

    Kevin W - Itty

    01/04/2023, 3:51 PM
    Just access it off the
    env
    accessible to fetch requests within the DO.
  • j

    jed

    01/04/2023, 7:16 PM
    doesn't look like it, Buenos Aires DOs spawn in ATL/MIA/EWR... https://where.durableobjects.live/
  • h

    HardAtWork

    01/04/2023, 8:02 PM
    Btw, The counter is broken, but it should still be updating regularly
  • f

    florian

    01/05/2023, 3:59 AM
    I am building a game that allows multiple users (1-10) to talk to each other. I used Durable Objects that respond to web socket requests routed through a Cloudflare worker. I got to deploy the project today (yay!), but when I checked the billing section, I saw that I had already amassed 400 GB-s. After reading into it, it sounds like every second of connection is billed (not just when data is being sent or processed) instead of computation time when things are happening. Is this correct? Is there any way I can restructure my architecture to use less time (aside from polling)?
1...473474475...567Latest