Initialize worker

Hi, is there an idiomatic way to initialize worker outside of the fetch()? I want to try the new connect() to connect to the database, but I don't want to do that repeatedly for every request that fetch() may handle. Is there something better than global variable and a mutex?
1 Reply
Elliot Hesp
Elliot Hesp13mo ago
I believe it's only possible to connect inside of the handlers, much like other service bindings. Also it would always have to connect within each fetch from my understanding as to how workers run