worker.js: do not run wasm_bindgen multiple times
seems like this thing can fail occassionally. just don't run bindgen all the time.
This commit is contained in:
parent
fe22944cb4
commit
e562a8d7e4
|
@ -1,4 +1,5 @@
|
|||
const { handle_request_rs } = wasm_bindgen;
|
||||
var gen = false;
|
||||
|
||||
addEventListener('fetch', event => {
|
||||
event.respondWith(handleRequest(event.request))
|
||||
|
@ -9,6 +10,9 @@ addEventListener('fetch', event => {
|
|||
* @param {Request} request
|
||||
*/
|
||||
async function handleRequest(request) {
|
||||
if (!gen) {
|
||||
await wasm_bindgen(wasm);
|
||||
return await handle_request_rs(request);
|
||||
gen = true;
|
||||
}
|
||||
return await handle_request_rs(request);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue