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

    sathoro

    05/13/2023, 4:46 PM
    durable object alarms seem to be running more than once at a time with --local
  • s

    sathoro

    05/13/2023, 4:58 PM
    ^ this seems to be happening for sure, no issues when I push the worker to staging
  • s

    sathoro

    05/13/2023, 6:45 PM
    do alarms get "queued"? what I'm wondering is if you are inside an alarm handler would there be a difference between setting an alarm for now vs setting an alarm for 5 minutes if the current alarm handler will take 10 minutes?
  • u

    Unsmart | Tech debt

    05/13/2023, 6:54 PM
    Alarms don’t get queued they overwrite each other you can only have 1 alarm set. As far as the behavior of setting an alarm while one is running I have no idea how that works 🤷
  • s

    sathoro

    05/13/2023, 7:04 PM
    seems to work. but I am seeing some really weird behavior. is there any situation where
    this.state.idFromName
    would be
    undefined
    in an alarm handler? when the alarm handler is running and there is an alarm set to be run and new code is deployed, it runs the next alarm after the deploy but
    this.state.idFromName
    is
    undefined
    and the alarm on the original DO is never run
  • u

    Unsmart | Tech debt

    05/13/2023, 7:06 PM
    Im not sure when it is defined, afaik it wasnt ever even supposed to exist there in the first place. But perhaps they define it whenever you make a fetch request with a stub that you get by called idFromName
  • s

    sathoro

    05/13/2023, 7:07 PM
    the main problem I'm running into is that the alarm doesn't seem to get retried when the handler is still running and new code is deployed
  • s

    sathoro

    05/13/2023, 7:07 PM
    not sure best way around this
  • s

    sathoro

    05/13/2023, 7:08 PM
    I'll need to create a whole other DO to keep track of my other DOs if I can't find a better way around this 😦
  • s

    sathoro

    05/13/2023, 7:09 PM
    it might be because I'm setting another alarm in the handler so let me check that
  • s

    sathoro

    05/13/2023, 7:16 PM

    https://cdn.discordapp.com/attachments/773219443911819284/1107023585152880650/image.png▾

  • u

    Unsmart | Tech debt

    05/13/2023, 7:20 PM
    Is the error being thrown in the alarm handler? If not it cant really retry as it thinks it was successful after delivery. It is possible theres some bug around that though, and if so and can some-what easily be repro'ed we can put in a report of it to be looked at
  • s

    sathoro

    05/13/2023, 7:20 PM
    yeah in the handler
  • s

    sathoro

    05/13/2023, 7:21 PM
    another DO with a
    null
    idFromName
    alarm gets called immediately after the error
  • s

    sathoro

    05/13/2023, 7:21 PM
    I'm using
    itty-durable
    , not sure if that is somehow causing it
  • u

    Unsmart | Tech debt

    05/13/2023, 7:22 PM
    I dont think idFromName is even supposed to exist there at all on the object and only on the stub.
  • s

    sathoro

    05/13/2023, 7:24 PM
    https://github.com/kwhitley/itty-durable/blob/v1.x/src/itty-durable.js#L113 gets added here
  • s

    sathoro

    05/13/2023, 7:24 PM
    it is always defined except in this one very weird scenario where I deploy code when an alarm handler is running
  • s

    sathoro

    05/13/2023, 7:25 PM
    that somehow triggers an alarm where its null. not sure what I'm missing 😦
  • u

    Unsmart | Tech debt

    05/13/2023, 7:26 PM
    Ok so its exactly as I said. Itty is adding the idFromName value if you call
    fetch
    on a stub that you got using
    idFromName(<name>)
    . Basically it will never be there for an alarm unless it happens to still be active after a fetch request.
  • s

    sathoro

    05/13/2023, 7:26 PM
    ah
  • s

    sathoro

    05/13/2023, 7:27 PM
    so what is a reliable way to get the DO's id?
  • s

    sathoro

    05/13/2023, 7:27 PM
    oh here is the other thing though: the storage is blank on the object
  • u

    Unsmart | Tech debt

    05/13/2023, 7:27 PM
    the name or the id? The id is this.state.id The name you would need to pass on fetch and save into storage
  • s

    sathoro

    05/13/2023, 7:27 PM
    the name I mean
  • s

    sathoro

    05/13/2023, 7:27 PM
    I checked and the storage was blank
  • s

    sathoro

    05/13/2023, 7:28 PM
    maybe itty-durable issue?
  • u

    Unsmart | Tech debt

    05/13/2023, 7:28 PM
    if you arent saving anything to storage the storage will be blank
  • s

    sathoro

    05/13/2023, 7:28 PM
    no these DOs have a lot of data in them
  • s

    sathoro

    05/13/2023, 7:28 PM
    it was reset to the default values from the constructor
1...554555556...567Latest