chore(cli): replace threads with tinypool#2420
Conversation
|
@yslpn is attempting to deploy a commit to the Crowdin Team on Vercel. A member of the Team first needs to authorize it. |
Codecov Report❌ Patch coverage is ❌ Your patch status has failed because the patch coverage (68.62%) is below the target coverage (70.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## next #2420 +/- ##
===========================================
+ Coverage 76.66% 88.00% +11.33%
===========================================
Files 81 113 +32
Lines 2083 3301 +1218
Branches 532 965 +433
===========================================
+ Hits 1597 2905 +1308
+ Misses 375 356 -19
+ Partials 111 40 -71 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I pushed some slight changes in types, just wanted to have call to Also i'm wondering about: minThreads: poolSize,
maxThreads: poolSize,Probably we should set only a maxThreads, so if there would be only 2 tasks, and poolSize = 5, it will not spawn 3 extra workers. It's better to consult actually what their docs saying about best practicies and maybe check vitest code how they works with those parameters. |
Thanks
I found that vitest was removed from vitest and they wrote their own implementation https://vitest.dev/guide/migration.html#pool-rework I looked at how facebook/docusaurus uses it; they also use the same values for maxThreads and minThreads. They calculate the ideal number for themselves based on pages: 50 pages → 1 thread In our case, we have two options:
Plus, we need to adjust all the messages, as there will be two cases:
Is that okay? |
|
It seems from the docs (from upstream piscina):
That totally makes sense |
|
@andrii-bodnar regarding coverage - disregard this report, since workers are not instrumented by covergae because they run in kinda separate process. The functionality is covered in the original implementation - this change doesn't add anything to logic we already have. |
Description
Replace
threadslibrary withtinypoolfor worker pool management in CLI package.Motivation:
tinypoolis a more actively maintained and lightweight alternativethreadsPromise.allinstead ofpool.queue/pool.completedKey changes:
typedPool.ts- generic typed wrapper around TinypoolworkerPools.ts- factory functions for all worker pools (extract, extract-experimental, compile)expose()from threadspool.run([...args])instead ofpool.queue(worker => worker(...))Types of changes
Fixes # (issue)
Checklist