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

    mz

    08/23/2021, 11:46 AM
    checking...
  • i

    ItsWendell

    08/23/2021, 11:46 AM
    Are you requesting the Websocket with the right headers from your other origins? Edit: Wrong question, what is the endpoint supposed to return?
  • i

    ItsWendell

    08/23/2021, 11:47 AM
    It shouldn't return a websocket then right? Since that's only from the Worker to the DO?
  • m

    mz

    08/23/2021, 11:48 AM
    The client does not speak websockets. It communicates using plain old http with a Worker. The worker simply returns the usual http responses. The worker, however, needs to connect to a DO over ws (not proxy a client's ws over to a DO).
  • i

    ItsWendell

    08/23/2021, 11:49 AM
    I think the worker will die as soon as you give it a response though, unless you give it a waitUntil and wait for something
  • i

    ItsWendell

    08/23/2021, 11:50 AM
    Are you expecting the worker to continue running after a response have been given to the request?
  • m

    mz

    08/23/2021, 11:50 AM
    Yes, not always. But because our request rate is too high, we sometimes have seen a single worker serve 25% or more requests and live much much longer.
  • i

    ItsWendell

    08/23/2021, 11:51 AM
    Okay, so where are you getting the 404, when you do the request to the worker or to the DO?
  • m

    mz

    08/23/2021, 11:52 AM
    That is what has us stumped because the same route is reachable when proxying websocket (ws) from the client via the same worker terminating that ws in a DO (as you are doing it).
  • m

    mz

    08/23/2021, 11:53 AM
    It 404s when the Worker itself originates (instead of proxying) ws conns to DOs.
  • i

    ItsWendell

    08/23/2021, 1:01 PM
    Hmhmh, so what is it supposed to response on the request to the worker?
  • m

    mz

    08/23/2021, 1:28 PM
    It is supposed to send back a webSocket client...
  • m

    mz

    08/23/2021, 1:29 PM
    You were right. It was the routes. From Browser, for some reason, the route was found, but not from within another worker. Explicitly adding a "worker route' and a dns entry (with orange cloud), worked.
  • i

    ItsWendell

    08/23/2021, 1:35 PM
    Nice glad you solved it!
  • i

    ItsWendell

    08/23/2021, 3:57 PM
    Is there a way to detect weather a Worker / Durable Object has cold-started?
  • i

    ItsWendell

    08/23/2021, 3:58 PM
    I know that cold start duration is low but it's still existent right?
  • h

    HardAtWork

    08/23/2021, 4:02 PM
    Don't know about a Worker, but if you have an initialization step, you could probably have a boolean in it that is
    coldStart = true
    or something.
  • w

    Wallacy

    08/23/2021, 4:06 PM
    assuming i have key "1": this.storage.list({ start: '1', end: '1', }) This should return the key "1" because the start is inclusive. But does not return nothing (as the ending is exclusive); It's that supposed to work?
  • w

    Wallacy

    08/23/2021, 4:11 PM
    Can i make that a feature request? Should be nice to have xD
  • i

    ItsWendell

    08/23/2021, 6:59 PM
    Good one
  • g

    Greg-McKeon

    08/23/2021, 7:25 PM
    for a regular worker you could check for some global variable having been initialized.
  • d

    davidbarratt

    08/23/2021, 10:33 PM
    Is there a way to get the number (a count) of storage keys/values or do you have to use
    list()
    and then count them all?
  • d

    davidbarratt

    08/23/2021, 11:36 PM
    and if that is the best way... is there a limit to the number of items that can be returned by
    list()
    in a single request?
  • h

    HardAtWork

    08/23/2021, 11:37 PM
    Don't think so, as long as you script has enough memory left to read the list in.
  • j

    john.spurlock

    08/23/2021, 11:50 PM
    You can pass a
    limit
    as an option to the
    list
    call: https://developers.cloudflare.com/workers/runtime-apis/durable-objects#methods
  • d

    davidbarratt

    08/24/2021, 1:00 AM
    interesting... thanks!
  • s

    Subh

    08/24/2021, 7:44 AM
    Hey folks, I just started exploring DO recently. Working on an demo. Are there any example or docs on filtering or sorting? on the complex side.
  • a

    albert

    08/24/2021, 8:46 AM
    What are you looking to filter/sort? Durable Objects are just JavaScript classes.
  • s

    Subh

    08/24/2021, 8:47 AM
    Yes! Sorry I should have just asked, in other words, it is still a good idea to filter data if you have 1M entries?
  • a

    albert

    08/24/2021, 8:58 AM
    I'm still not really sure what data you're trying to filter and why you'd do it on a Durable Object. Could you elaborate a bit?
1...162163164...567Latest