summaryrefslogtreecommitdiff
path: root/platform/javascript
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2022-05-11 00:11:29 +0200
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2022-05-11 00:26:02 +0200
commit9bdb853eecd56bc905e5a766731a64034b54c96c (patch)
treeee3442e9c04d3be6d9c675c4326aacead32be515 /platform/javascript
parent39d9a5540c770242388d02397da4f6a00b09ccbc (diff)
[HTML5] Limit the returned OS cpu count to 2.
Temporarily workaround issues due to godot spawning too many threads.
Diffstat (limited to 'platform/javascript')
-rw-r--r--platform/javascript/js/libs/library_godot_os.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/platform/javascript/js/libs/library_godot_os.js b/platform/javascript/js/libs/library_godot_os.js
index 12d06a8d51..377eec3234 100644
--- a/platform/javascript/js/libs/library_godot_os.js
+++ b/platform/javascript/js/libs/library_godot_os.js
@@ -305,7 +305,9 @@ const GodotOS = {
godot_js_os_hw_concurrency_get__sig: 'i',
godot_js_os_hw_concurrency_get: function () {
- return navigator.hardwareConcurrency || 1;
+ // TODO Godot core needs fixing to avoid spawning too many threads (> 24).
+ const concurrency = navigator.hardwareConcurrency || 1;
+ return concurrency < 2 ? concurrency : 2;
},
godot_js_os_download_buffer__sig: 'viiii',