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

    kian

    05/02/2023, 3:01 PM
    That looks like the length of the string which isn't necessarily what the DO sees
  • k

    kian

    05/02/2023, 3:01 PM
    DO's use the V8 serialiser to write values
  • s

    sathoro

    05/02/2023, 3:02 PM
    the main thing taking up space is a single linked list like this
    Copy code
    json
    {
      "7b53671d-da26-4ab1-b096-6e014125f712:next": "2d87feb9-f8a5-49a6-aed2-22de950bb132"
      ... thousands more
    }
  • s

    sathoro

    05/02/2023, 3:03 PM
    seems like that should be over the size limit hmm
  • k

    kian

    05/02/2023, 3:03 PM
    Is this
    wrangler dev
    or
    wrangler dev --local
    ?
  • s

    sathoro

    05/02/2023, 3:03 PM
    --local
  • s

    sathoro

    05/02/2023, 3:04 PM
    I'm already storing the bigger values outside the default
    itty-durable
    object because I want this to be "infinite" but then I randomly realized today that we are storing this list in a single field. d'oh!
  • k

    kian

    05/02/2023, 3:05 PM
    Miniflare will be validating that stuff stored in DO's transactional storage is sub-128KiB
  • s

    sathoro

    05/02/2023, 3:05 PM
    the string is up to
    466275
    now
  • s

    sathoro

    05/02/2023, 3:05 PM
    but yeah maybe stored more optimized
  • s

    sathoro

    05/02/2023, 3:08 PM
    gonna move to different storage keys but wanted to test it first and was surprised it was not rejecting it
  • k

    kian

    05/02/2023, 3:08 PM
    As an example of one random test I did
  • k

    kian

    05/02/2023, 3:09 PM
    JSON length =
    261646
    serialized byteLength =
    121750
  • k

    kian

    05/02/2023, 3:09 PM
    The JSON string will always be much larger, since it escapes everything
  • k

    kian

    05/02/2023, 3:10 PM
    With the DO
    put
    , you'd pass the object as-is
  • s

    sathoro

    05/02/2023, 3:10 PM
    I created a pretty nice queuing mechanism with DO... it supports a dynamic number of in-progress items per queue (each DO object is one queue). we are going to use it for queueing long running async API requests. in our use case each user will use one queue
  • s

    sathoro

    05/02/2023, 3:10 PM
    would be 10x harder to build without DO
  • s

    sathoro

    05/02/2023, 3:16 PM
    Copy code
    FileStorageError [ERR_NAMESPACE_KEY_CHILD]: Cannot put key "1da8654e-f195-454b-9cd9-469d5d16ced4:next" as a parent namespace is also a key.
    This is a limitation of Miniflare's file-system storage. Please use in-memory/Redis storage instead, or change your key layout.
    uh-oh, wat
  • s

    sathoro

    05/02/2023, 3:17 PM
    I don't know what this means hmm
  • s

    sathoro

    05/02/2023, 3:18 PM
    okay I changed the key from
    {uuid}:next
    to
    next:{uuid}
  • s

    sathoro

    05/02/2023, 3:19 PM
    now my queue is officially infinite
  • s

    sathoro

    05/02/2023, 3:23 PM
    Copy code
    bash
    ITTY-DURABLE STORAGE SIZE 109
    FULL STORAGE SIZE 556274
  • s

    sathoro

    05/02/2023, 4:04 PM
    oh yeah I had a dumb question. is it possible to directly call a worker from a DO? or is doing fetch on the Worker's URL the best way?
  • s

    sathoro

    05/02/2023, 4:25 PM
    like a service binding but to the same worker 🤔
  • s

    Skye

    05/02/2023, 4:26 PM
    I don't think there's any nice way really
  • s

    Skye

    05/02/2023, 4:27 PM
    Could perhaps be a cool #1064502845061210152 👀
  • d

    Dani Foldi

    05/02/2023, 4:27 PM
    Since it's the same codebase, you can use any functions you export in your worker normally - there is no binding added automatically
  • u

    Unsmart | Tech debt

    05/02/2023, 4:28 PM
    You can also use a service binding to the same worker fwiw
  • s

    Skye

    05/02/2023, 4:28 PM
    Oh that's true, you could just import the normal function haha
  • s

    Skye

    05/02/2023, 4:28 PM
    til
1...544545546...567Latest