feat: per worker max threads (#1962)
* adds worker max_threads
* Adds tests for all calculation cases.
* Adds max_threads limitation to test.
* Removes the test sleep.
* Adds max_threads to error message.
* correctly uses continue.
* Fixes logic with only worker max_threads set.
* Adjust comments.
* Removes unnecessary check.
* Fixes comment.
* suggestions by @dunlgas.
* copilot suggestions.
* Renames logger.
* review
---------
Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>