https://discord.cloudflare.com logo
Join Discord
Powered by
# workers-discussions
  • o

    Ottomated

    04/27/2023, 2:01 PM
    No, I think it's correct
  • o

    Ottomated

    04/27/2023, 2:02 PM
    When I did a dry run, it gave me this
  • o

    Ottomated

    04/27/2023, 2:02 PM
    and this
  • h

    HardAtWork

    04/27/2023, 2:14 PM
    Oh huh, that's new...
  • h

    HardAtWork

    04/27/2023, 2:14 PM
    At least it used to inline them
  • o

    Ottomated

    04/27/2023, 2:15 PM
    Yeah it's definitely new
  • o

    Ottomated

    04/27/2023, 2:16 PM
    I'm guessing the bundled gzip is stored in quicksilver in this case, and unzipped for cold starts, then kept alive
  • o

    Ottomated

    04/27/2023, 2:16 PM
    but I don't know enough about workerd
  • s

    sathoro

    04/27/2023, 3:02 PM
    wait you can really save a .txt file and then just import it in your worker?
  • s

    sathoro

    04/27/2023, 3:03 PM
    this would have been nice to know
  • j

    James

    04/27/2023, 3:04 PM
    yep you can 🙂
  • w

    wesbos

    04/27/2023, 3:32 PM
    Heyo, are there any ways to help figure out why
    Error: Script startup exceeded CPU time limit.
    is happening? I understand the script startup is taking too long, but how can I measure it?
  • s

    Skye

    04/27/2023, 3:33 PM
    The script startup counts as all of the code that's happening outside of your request handler, i.e. in the global scope. Anything you're running there that can be done inside your fetch handler, I recommend moving
  • w

    wesbos

    04/27/2023, 3:33 PM
    The startup includes parsing and running all code in the worker, correct?
  • s

    Skye

    04/27/2023, 3:33 PM
    It could also be the fault of libraries you're importing
  • s

    Skye

    04/27/2023, 3:34 PM
    The parsing yes, the running of code, not all. It's only the code outside your handler
  • w

    wesbos

    04/27/2023, 3:34 PM
    Its not the import, the creation of the
    agent
    here:
  • w

    wesbos

    04/27/2023, 3:34 PM
    Oh yeah, the agent is outside the handler
  • s

    Skye

    04/27/2023, 3:34 PM
    It's very possible that's doing it, yes
  • w

    wesbos

    04/27/2023, 3:34 PM
    am I just out of luck with Cloudflare then?
  • t

    Tom Sherman

    04/27/2023, 3:35 PM
    FYI console.time isn't accurate at all AFAIA
  • s

    Skye

    04/27/2023, 3:35 PM
    Just move it inside your handler
  • w

    wesbos

    04/27/2023, 3:35 PM
    but then wouldn't that put my handler over the 10ms?
  • w

    wesbos

    04/27/2023, 3:35 PM
    200ms startup, 10ms handler. Correct?
  • s

    Skye

    04/27/2023, 3:35 PM
    That's cpu time, not wall time
  • w

    wesbos

    04/27/2023, 3:35 PM
    Oh and the startup isn't CPU Time?
  • s

    Skye

    04/27/2023, 3:36 PM
    No
  • j

    James

    04/27/2023, 3:36 PM
    > but how can I measure it? You can't very well unfortunately. Observability for Workers is a pain point with DX right now. But yeah as @Skye mentions, the most common form of this is initialising things outside of the fetch handler. Your best option is to move it inside of the handler, and then if you really see a benefit, you can cache it on
    globalThis
    or something. I would heavily doubt it consumes much CPU time to be an issue just doing it inside the handler though.
  • w

    wesbos

    04/27/2023, 3:36 PM
    That makes sense, let me try that!
  • t

    Tom Sherman

    04/27/2023, 3:36 PM
    this confuses so many people i think, i don't think the docs are very clear that startup time is measured in real ms not CPU
1...242024212422...2509Latest