2anki / server

Server to create Anki flashcards faster, easier and better today ⭐️
https://2anki.net
Other
309 stars 33 forks source link

feat: Implement worker threads for upload processing #1591

Closed aalemayhu closed 2 months ago

aalemayhu commented 3 months ago

Unfortunately the node worker threads cannot share buffers reliably with the main thread. I learned this the hard way 😅 So I have move all of the read writes of the APKG payload to be be based on file system access which is thread safe since we only read after writes.

While reviewing the code path, I discovered that we actually do a lot of wasteful reads and writes. Essentially for every APKG generation we make 2x calls due to the renaming to provide the uploader with friendly name. I have not measured how long this takes but instead of double work we do this one time and rely on the create_deck having the right name.

Revert of revert https://github.com/2anki/server/pull/1589 Reference: https://github.com/2anki/create_deck/pull/93

sonarcloud[bot] commented 2 months ago

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarCloud

Catch issues before they fail your Quality Gate with our IDE extension SonarLint