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

    Skye

    11/29/2022, 8:03 PM
    Not personally used DOs before so I wanted to make sure my assumptions were all correct
  • b

    brett

    11/29/2022, 8:03 PM
    Oh don't forget, no TTL in DOs, so you'd need to tag them with a timestamp and clean them up (if you want)
  • b

    brett

    11/29/2022, 8:03 PM
    Or else you'd always read stale DO "cached" data
  • s

    Skye

    11/29/2022, 8:04 PM
    Oh - interesting, thanks for the pointer
  • h

    HardAtWork

    11/29/2022, 8:04 PM
    Any plans to add a way to specifically say “even though my closest colo is SJC, make my DO in IAD anyway”? I know you can fudge it with a proxy, but that’s kind of clunky
  • h

    HardAtWork

    11/29/2022, 8:04 PM
    Or #960679900929478666?
  • b

    brett

    11/29/2022, 8:05 PM
    Yeah if you want/need to proactively clean them up. I was thinking more of putting a timestamp in with the data, so on DO read if it's >1min old you have to DO talk to D1 and update the value, or something
  • b

    brett

    11/29/2022, 8:05 PM
    Yeah soon hopefully
  • s

    Skye

    11/29/2022, 8:05 PM
    Fwiw I currently store them for 2 weeks, then let it revalidate - could do the same on a DO I imagine (just have to check the timestamp myself)
  • t

    thebatt

    11/29/2022, 10:32 PM
    What is the arraybuffer equivalent of "await response.text()" for DOs? I am having to collect the Stream data and convert as it is...
  • u

    Unsmart | Tech debt

    11/29/2022, 10:43 PM
    https://developer.mozilla.org/en-US/docs/Web/API/Response/arrayBuffer
  • a

    aranchelk

    11/30/2022, 2:50 AM
    Maybe a kind of dumb question: if I want to completely delete a durable object, do I just deleteAll() on storage and just wait for the object to spin down? Do I have to do anything else?
  • u

    Unsmart | Tech debt

    11/30/2022, 4:03 AM
    thats all
  • s

    samakintunde

    11/30/2022, 10:05 AM
    Hey, all. Not the most efficient can Durable Objects be published without wrangler? **Context**: whenever I make updates to a worker, I build the project using
    wrangler publish --dry-run
    to a
    dist
    directory and then send the built script to Sys Admins who upload the script manually using the CF dashboard. We turned on Durable Objects and I do a named export of a class as the Durable Object but it doesn't show up as a binding.
  • d

    Dani Foldi

    11/30/2022, 10:33 AM
    Hi, I believe you can publish DOs, and now alarms are standard so that's not an issue, however the migration needs to be applied via wrangler.toml, so at least once you would have to publish directly from
    wrangler publish
    - and I'd recommend to do so in all cases, you get a lot more control over the project that way See https://developers.cloudflare.com/workers/wrangler/configuration/#source-of-truth and https://developers.cloudflare.com/workers/wrangler/configuration/#migrations <-- you'll need to add a
    new_classes
    migration as shown here
  • s

    samakintunde

    11/30/2022, 10:50 AM
    Ah! It worked. Thanks a lot. You're right. The Durable Objects configuration wasn't being passed along when I built the script so the bindings weren't available. I totally agree with you on using
    wrangler
    and being able to version the
    wrangler.toml
    file.
  • j

    john.spurlock

    12/02/2022, 4:29 PM
    Good morning! I'm aware that the worker trace events logpush logs for
    alarm
    handlers are not implemented fully yet (the record is there, but no detail), but I'm curious if each unhandled alarm error will cause an "outcome" = "exception" record (ie for each retry, up to six), or just the final error (out of retries). From what I'm seeing, I'm pretty sure it's the former, but would like confirmation from someone orange, thanks!
  • m

    matt

    12/02/2022, 4:42 PM
    Yep, the former
  • c

    cosnavel

    12/03/2022, 7:41 AM
    Any updates on that ?
  • m

    Mihaaai

    12/03/2022, 6:52 PM
    I was wondering if the DO alarms that are triggered through
    do-taskmanager
    will also increase the count of workers triggers. If I have 10 DOs with an alarm attached for each one, would this mean that also the workers trigger count will increase of 10 adding up after they are all invoked?
  • w

    William Blankenship

    12/03/2022, 8:34 PM
    Silly question. I have a DurableObject that needs to make a
    fetch
    request to the
    stream/live_inputs
    API. I added my
    API_KEY
    to my cloudflare worker. But there doesn't seem to be a way to pass the
    env
    to a DurableObject... How do I get my API_KEY into the durable object? Should I include it in the incoming request as a header?
  • u

    Unsmart | Tech debt

    12/03/2022, 8:36 PM
    all the env values on your worker are already available to the DO in the same way as the normal worker
  • u

    Unsmart | Tech debt

    12/03/2022, 8:37 PM
    well kind of the same way, its the second param of the constructor
  • w

    William Blankenship

    12/03/2022, 8:40 PM
    Oh 🤦‍♂️ I was trying to add it to the
    fetch
    method
  • w

    William Blankenship

    12/03/2022, 8:41 PM
    Ignore me - thanks for the help!
  • t

    Tobias Lins

    12/04/2022, 2:33 PM
    how many subrequests can a DO do when its running 24/7? 1000?
  • t

    Tobias Lins

    12/04/2022, 2:41 PM
    or, how can I archive more than 1000 fetches in a durable object
  • a

    aarhus

    12/04/2022, 5:47 PM
    you can: - use websockets within the DO - retrieve the list of fetches to carry them out, batch them up and then send them to the websocket. The receiver can then work through the batch - use queues - use a DO alarm - create an internal queue (who's operations are protected by blockConcurrencyWhile) and then pop X requests for each alarm...
  • k

    kenton

    12/05/2022, 6:32 PM
    The durable object's outgoing subrequest limit is topped-up every time it receives an incoming request, WebSocket message, or alarm. So if you are receiving incoming traffic then your outgoing limit should be continuously reset. If you aren't receiving incoming traffic, then the DO will shut down after a short time.
  • t

    Tobias Lins

    12/05/2022, 6:57 PM
    What does a always busy DO cost per month? about $10-12 is what I calculated, am I right?
1...451452453...567Latest