Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(web): clamp default number of threads to 3 #1512

Merged
merged 1 commit into from
Jul 12, 2024

Conversation

ivan-aksamentov
Copy link
Member

Resolves: #1511

Firefox returns some random number for navigator?.hardwareConcurrency. In my case is was 16, which does not correspond to the avaialble hardware in any way.

Here I additionally clamp the value obtained from navigator?.hardwareConcurrency to a range from DEFAULT_NUM_THREADS to MAXIMUM_NUM_THREADS (currently from 2 to 3).

This solves it for Firefox, but I don't have a physical mac handy to test Safari. Not sure if testing on Browserstack is accurate - it probably runs on a VM.

Resolves: #1511

Firefox returns some random number for `navigator?.hardwareConcurrency`. In my case is was `16`, which does not correspond to the avaialble hardware in any way.

Here I additionally clamp the value obtained from `navigator?.hardwareConcurrency` to a range from `DEFAULT_NUM_THREADS` to `MAXIMUM_NUM_THREADS` (currently  from 2 to 3).

This solves it for Firefox, but I don't have a physical mac handy to test Safari. Not sure if testing on Browserstack is accurate - it probably runs on a VM.
Copy link

vercel bot commented Jul 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nextclade ✅ Ready (Inspect) Visit Preview Jul 12, 2024 2:17pm

Copy link
Member

@corneliusroemer corneliusroemer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! The only downside is one can't use more than max threads anymore, but I don't think there's a need to do so, 3 are enough, it doesn't scale anyways higher than that.

I tested on Safari and it works.

Safari 2024-07-12 17 10 52

@ivan-aksamentov ivan-aksamentov merged commit b5b330a into master Jul 12, 2024
20 checks passed
@ivan-aksamentov ivan-aksamentov deleted the fix/web-num-threads branch July 12, 2024 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Default threads for webapp are set too high
2 participants