fix: Limit web workers used by ALTCHA to prevent Firefox (and maybe others?) from crashing
As per #139 (closed), there's an issue currently present on the donation form which is crashing browsers in the wild. The current suspicion is that it has to do with the number of web workers the ALTCHA plugin is leveraging (which always uses the maximum value of what's available).
This MR sets that number to Math.max(navigator.hardwareConcurrency / 2, 1)
in an attempt to see if "fewer than all 16" will prevent the issue. Computers with only one core to spare for web workers will use it as normal, while other users will not have their CPU usage slammed so harshly.
Merge request reports
Activity
requested review from @anarcat
assigned to @stephen
@anarcat As the lucky winner of the "person whose browser is reliably crashing" lottery, your feedback here is the most important. :)
Once we can get this working for you, I'll ask a few others to test on staging to make sure that this change works well in the reverse scenario - how long it takes computers with fewer workers to throw at the problem if they have fewer resources to spare. Going from 16 to 8 had no noticeable effect on my end, but I am running a desktop with 12 cores and a big GPU, so I don't consider myself a helpful test subject in that regard.
- Resolved by anarcat
So this works in the sense that it doesn't crash or hang my browser, but it doesn't work in the sense that:
- i can't select a country
- the "Verification failed. Try again later."
- I can't click the resulting "I'm not a robot" checkbox
Clicking the checkbox triggers the error
ALTCHA TypeError: Window.fetch: /challenge/ is an url with embedded credentials.
in my browser console.There's also an error (
Uncaught (in promise) TypeError: statesColl is null
) earlier.Again, testing in a blank browser profile.
mentioned in merge request !160 (merged)
mentioned in commit 57547915
mentioned in issue #139 (closed)