Closed beingflo closed 3 years ago
All algorithms should work within web workers. There is nothing special in bcrypt
.
I don't have a lot of experience with Deno, but according to the docs it seems to behave similarly to Node.js: execution is single-threaded even if you have async code.
So, if you don't want to block the main thread, you will have to create web workers and compute hashes there.
When writing backends, the traditional solution in Node.js is to create a "cluster" of backend instances. So basically you run multiple backend processes with all of them listening on the same port.
Aha, I misunderstood the documentation to mean that the worker is already built into the library. Starting a worker at the call site works as expected. Thanks!
I'm implementing a service with oak and use bcrypt for hashing passwords. It appears to me that the
bcrypt
call is blocking the main thread in Deno, as no other request is served while a costly hash is running. Am I misunderstanding web workers or is this not supported for bcrypt?Thanks for your work!