cloudflare / cloudflare/workers-rs
The script will never generate a response: worker-build should emit all code inside a closure in a fetch function
- Dominant language
- Rust
- Stars
- 3.7k
- Forks
- 429
- Avg merge
- 20h 28m
- Merged PRs (30d)
- 7
Description
### Is there an existing issue for this?
- [X] I have searched the existing issues
### What version of `workers-rs` are you using?
0.0.0
### Describe the bug
Currently, the emitted code for `worker-build` has everything defined on the top-level.
I'm not sure why, but for some reason variables defined in the top level are re-used across requests.
I'm using the [`cached` crate](https://crates.io/crates/cached) in my project, and because the wasm memory is re-used across requests - it stops working and hangs with `The script will never generate a response.`
I'm not sure if this is the intended behaviour, re-using the wasm memory across requests - maybe it was done for perf reasons?
But anyways I've ran into this issue of randomly hanging workers loads of times, and it's really annoying. I think the default should be not to re-use memory across requests
### Steps To Reproduce
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.