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

    ckoeninger

    05/16/2023, 2:48 PM
    if you're using the DO as a source of truth rather than just coordinating writes, keep in mind what happens if DO storage write succeeds and KV write fails
  • c

    ckoeninger

    05/16/2023, 2:52 PM
    i.e. is it bad for your use case if they're out of sync for an extended time, are you ok with setting a DO alarm to retry KV writes
  • j

    jesseditson

    05/16/2023, 6:06 PM
    Thank you, very helpful!
  • j

    jesseditson

    05/16/2023, 6:08 PM
    Any docs I could look at to go deeper on both KV write failure modes (curious if they can fail outside of a write operation or if I need to just write my own transaction-like behavior), and/or DO alarms?
  • c

    ckoeninger

    05/16/2023, 7:01 PM
    as far as alarms go, besides the existing docs there's the announcement blog post with an example at https://blog.cloudflare.com/durable-objects-alarms/
  • c

    ckoeninger

    05/16/2023, 7:06 PM
    KV wise, I'm not the KV manager any more so you may be better off asking in the KV specific channel; my main point wasn't so much about esoteric failure modes but the obvious one of DO writes works and KV write doesn't for whatever reason. As long as you give your alarm handler a way to tell that a given DO value hasn't been successfully written to KV so it can retry, should be ok
  • j

    jesseditson

    05/16/2023, 7:39 PM
    Appreciate it, this seems like enough to get me started! Thanks again.
  • l

    Larry

    05/17/2023, 2:07 AM
    I had assumed that while the value of the KV may or may not be in cache, the key and metadata were kept in some sort of in-memory index. Are the keys in memory but not the metadata? Or are neither of them likely in memory?
  • h

    HardAtWork

    05/17/2023, 6:38 AM
    IIRC, either everything is in Cache, or nothing is.
  • a

    AA

    05/17/2023, 11:28 AM
    playing with the new tcp beta which i can use for postgres.. Can/Should connection pools go to a durable object? and how would that work
    Copy code
    ts
    import { Pool } from 'pg'
    import { DB } from './kysley-db'
    import { Kysely, PostgresDialect } from 'kysely';
    
    const db = new Kysely<DB>({
        dialect: new PostgresDialect({
          pool: new Pool({
            connectionString: "the_url",
          }),
        }),
      });
  • a

    AA

    05/17/2023, 11:30 AM
    tho i wonder if the entire thing should be a DO
  • c

    ckoeninger

    05/17/2023, 3:38 PM
    is there something you read that led you to assume that?
  • m

    mpeg

    05/17/2023, 6:00 PM
    With all the upcoming changes to pages, I wonder if being able to deploy DOs from a pages deployment is in the roadmap? It’s not a huge issue to deploy them as normal workers but it would be nice to unify it
  • s

    Skye

    05/17/2023, 6:05 PM
    Just asked this for you in the Dev Week Pages call - It is on the roadmap, yes
  • m

    mpeg

    05/17/2023, 6:16 PM
    Thanks for asking! That’s awesome, it’ll be a very nice feature to reduce complexity
  • b

    Bitmonkey

    05/17/2023, 6:31 PM
    Hello Beautiful Cloudflarians, I am having an issue where my durable object is setting up a web socket connection. This works as expected in my local dev environment but not when I deploy it. I am a bit lost about the next steps to take to try to fix the issue. Has anyone run into such a problem before or knows how I can track down the bug?
  • d

    Dani Foldi

    05/17/2023, 6:41 PM
    👋 Hi, could you share your DO code with us?
  • c

    ckoeninger

    05/17/2023, 7:04 PM
    have you tried deploying the websocket example at https://github.com/cloudflare/workers-chat-demo
  • b

    Bitmonkey

    05/17/2023, 7:20 PM
    I will take a look at that repo and go through all the code tomorrow. I am using hono btw.
  • b

    Bitmonkey

    05/17/2023, 7:37 PM
    Typical... spent 5 hours trying to solve a problem on my own, ask for help and then spot the problem I was having. lol.
  • b

    Bitmonkey

    05/17/2023, 7:43 PM
    Thanks for the replies though.
  • b

    Bitmonkey

    05/17/2023, 8:21 PM
    Quack
  • a

    aarhus

    05/17/2023, 9:01 PM
    I once spent three days trying to debug an issue, turns out I had managed to fix the issue within 10 minutes of starting to investigate. The remining 3 days were due to a new bug that was introduced by the debuging....
  • b

    Bitmonkey

    05/17/2023, 9:04 PM
    Yep, thats exactly why I just went into all open files doing a loooooong ctrl-z
  • b

    Bitmonkey

    05/17/2023, 9:04 PM
    removing lots of console.log("WTF!")
  • l

    Larry

    05/17/2023, 10:04 PM
    "Assumed" is probably too strong. Maybe "guessed". I didn't read anything that says otherwise and I know it says that it's not memcache but it just has so many similarities to things like memcache. Also, databases try to keep their indexes in memory. I think of the key as the field that is always indexed. Because metadata came back with list() operations, I guessed it was probably with the keys and only the values required disk round trips. I take your response to mean, that's not the case.
  • f

    faraday

    05/18/2023, 8:03 AM
    it seems like smart placement doesn't work with durable objects
  • f

    faraday

    05/18/2023, 8:03 AM
    i have the following scheme: database <- durable object <- worker with smart placement
  • f

    faraday

    05/18/2023, 8:04 AM
    i kinda want all of the things to be close to database but worker (with smart placement) always displays insufficient requests
  • f

    faraday

    05/18/2023, 8:07 AM
    is there a way to make it work?
1...557558559...567Latest