diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-10-11 19:09:04 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-10-11 19:09:04 +0200 |
| commit | 176b5ed563f7022009b70751e62b7ee7901e6da0 (patch) | |
| tree | dfc3d3b4653cb63ef680cfd5d914fe52ba3a9635 /packages/meshbay-hub | |
| parent | aca58f66df5c21be71a7159620d0b50bb969199f (diff) | |
| download | meshbay-176b5ed563f7022009b70751e62b7ee7901e6da0.tar.gz | |
feat(node): carry connections on several cores
connection_processes (default 1) starts that many processes for the
WebRTC stack; sessions and keys stay in the node. Set from node.toml
or the Node page, applied to new connections.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-hub')
12 files changed, 68 insertions, 0 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/locales/de.js b/packages/meshbay-hub/src/meshbay_hub/static/locales/de.js index 17b8c2b..d8381e1 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/locales/de.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/locales/de.js @@ -985,6 +985,8 @@ export default { 'node.setting_max_uploads': 'Max. gleichzeitige Uploads', 'node.setting_transcode': 'Transcode incompatible video', 'node.setting_max_upload': 'Größter einzelner Upload', + 'node.setting_connection_processes': 'CPU-Kerne für Verbindungen', + 'node.setting_unit_of': 'von {n}', 'node.setting_unit_gb': 'GB', 'node.setting_unit_hours': 'hours', 'node.setting_unit_minutes': 'min', diff --git a/packages/meshbay-hub/src/meshbay_hub/static/locales/en.js b/packages/meshbay-hub/src/meshbay_hub/static/locales/en.js index a4e07a1..07c885d 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/locales/en.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/locales/en.js @@ -1135,6 +1135,8 @@ export default { 'node.setting_max_uploads': 'Max concurrent uploads', 'node.setting_transcode': 'Transcode incompatible video', 'node.setting_max_upload': 'Largest single upload', + 'node.setting_connection_processes': 'CPU cores for connections', + 'node.setting_unit_of': 'of {n}', 'node.setting_unit_gb': 'GB', 'node.setting_unit_hours': 'hours', 'node.setting_unit_minutes': 'min', diff --git a/packages/meshbay-hub/src/meshbay_hub/static/locales/es.js b/packages/meshbay-hub/src/meshbay_hub/static/locales/es.js index e8ea3e7..a6fb30f 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/locales/es.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/locales/es.js @@ -979,6 +979,8 @@ export default { 'node.setting_max_uploads': 'Subidas simultáneas máximas', 'node.setting_transcode': 'Transcode incompatible video', 'node.setting_max_upload': 'Subida individual máxima', + 'node.setting_connection_processes': 'Núcleos de CPU para las conexiones', + 'node.setting_unit_of': 'de {n}', 'node.setting_unit_gb': 'GB', 'node.setting_unit_hours': 'hours', 'node.setting_unit_minutes': 'min', diff --git a/packages/meshbay-hub/src/meshbay_hub/static/locales/fr.js b/packages/meshbay-hub/src/meshbay_hub/static/locales/fr.js index 0d927ae..c38be75 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/locales/fr.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/locales/fr.js @@ -982,6 +982,8 @@ export default { 'node.setting_max_uploads': 'Téléversements simultanés max', 'node.setting_transcode': 'Transcoder les vidéos incompatibles', 'node.setting_max_upload': 'Taille maximale d\'un envoi', + 'node.setting_connection_processes': 'Cœurs CPU pour les connexions', + 'node.setting_unit_of': 'sur {n}', 'node.setting_unit_gb': 'GB', 'node.setting_unit_hours': 'heures', 'node.setting_unit_minutes': 'min', diff --git a/packages/meshbay-hub/src/meshbay_hub/static/locales/it.js b/packages/meshbay-hub/src/meshbay_hub/static/locales/it.js index e2c6df3..05f903e 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/locales/it.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/locales/it.js @@ -981,6 +981,8 @@ export default { 'node.setting_max_uploads': 'Caricamenti simultanei massimi', 'node.setting_transcode': 'Transcode incompatible video', 'node.setting_max_upload': 'Caricamento singolo massimo', + 'node.setting_connection_processes': 'Core CPU per le connessioni', + 'node.setting_unit_of': 'su {n}', 'node.setting_unit_gb': 'GB', 'node.setting_unit_hours': 'hours', 'node.setting_unit_minutes': 'min', diff --git a/packages/meshbay-hub/src/meshbay_hub/static/locales/ja.js b/packages/meshbay-hub/src/meshbay_hub/static/locales/ja.js index 9aa4833..bd63b4f 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/locales/ja.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/locales/ja.js @@ -969,6 +969,8 @@ export default { 'node.setting_max_uploads': '同時アップロードの上限', 'node.setting_transcode': 'Transcode incompatible video', 'node.setting_max_upload': '1ファイルあたりの上限', + 'node.setting_connection_processes': '接続に使う CPU コア数', + 'node.setting_unit_of': '/ {n}', 'node.setting_unit_gb': 'GB', 'node.setting_unit_hours': 'hours', 'node.setting_unit_minutes': 'min', diff --git a/packages/meshbay-hub/src/meshbay_hub/static/locales/nl.js b/packages/meshbay-hub/src/meshbay_hub/static/locales/nl.js index 863f7c9..eb6c6c2 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/locales/nl.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/locales/nl.js @@ -983,6 +983,8 @@ export default { 'node.setting_max_uploads': 'Max. gelijktijdige uploads', 'node.setting_transcode': 'Transcode incompatible video', 'node.setting_max_upload': 'Grootste enkele upload', + 'node.setting_connection_processes': 'CPU-kernen voor verbindingen', + 'node.setting_unit_of': 'van {n}', 'node.setting_unit_gb': 'GB', 'node.setting_unit_hours': 'hours', 'node.setting_unit_minutes': 'min', diff --git a/packages/meshbay-hub/src/meshbay_hub/static/locales/pl.js b/packages/meshbay-hub/src/meshbay_hub/static/locales/pl.js index 2dc2e74..1b97dae 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/locales/pl.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/locales/pl.js @@ -1003,6 +1003,8 @@ export default { 'node.setting_max_uploads': 'Maks. równoczesnych wysyłek', 'node.setting_transcode': 'Transcode incompatible video', 'node.setting_max_upload': 'Największa pojedyncza wysyłka', + 'node.setting_connection_processes': 'Rdzenie CPU dla połączeń', + 'node.setting_unit_of': 'z {n}', 'node.setting_unit_gb': 'GB', 'node.setting_unit_hours': 'hours', 'node.setting_unit_minutes': 'min', diff --git a/packages/meshbay-hub/src/meshbay_hub/static/locales/pt-BR.js b/packages/meshbay-hub/src/meshbay_hub/static/locales/pt-BR.js index 6c4f03b..a680cc8 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/locales/pt-BR.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/locales/pt-BR.js @@ -980,6 +980,8 @@ export default { 'node.setting_max_uploads': 'Máximo de envios simultâneos', 'node.setting_transcode': 'Transcode incompatible video', 'node.setting_max_upload': 'Maior envio individual', + 'node.setting_connection_processes': 'Núcleos de CPU para as conexões', + 'node.setting_unit_of': 'de {n}', 'node.setting_unit_gb': 'GB', 'node.setting_unit_hours': 'hours', 'node.setting_unit_minutes': 'min', diff --git a/packages/meshbay-hub/src/meshbay_hub/static/locales/zh-CN.js b/packages/meshbay-hub/src/meshbay_hub/static/locales/zh-CN.js index 8899ed0..ae16098 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/locales/zh-CN.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/locales/zh-CN.js @@ -957,6 +957,8 @@ export default { 'node.setting_max_uploads': '最大同时上传数', 'node.setting_transcode': 'Transcode incompatible video', 'node.setting_max_upload': '单个上传的最大大小', + 'node.setting_connection_processes': '用于连接的 CPU 核心数', + 'node.setting_unit_of': '/ {n}', 'node.setting_unit_gb': 'GB', 'node.setting_unit_hours': 'hours', 'node.setting_unit_minutes': 'min', diff --git a/packages/meshbay-hub/src/meshbay_hub/static/node-page.js b/packages/meshbay-hub/src/meshbay_hub/static/node-page.js index 56166c6..88167d3 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/node-page.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/node-page.js @@ -1188,6 +1188,16 @@ export function NodePage({ groups, token, username }) { </div> </label> <label class="node-setting"> + <span class="node-setting-label">${t('node.setting_connection_processes')}</span> + <div class="node-setting-input"> + <input type="number" min="1" max=${editSettings.cpu_count || 1} + value=${editSettings.connection_processes || 1} + onInput=${e => setEditSettings(s => ({...s, connection_processes: + Math.min(Math.max(parseInt(e.target.value) || 1, 1), s.cpu_count || 1)}))} /> + <span class="node-setting-unit">${t('node.setting_unit_of', { n: editSettings.cpu_count || 1 })}</span> + </div> + </label> + <label class="node-setting"> <span class="node-setting-label">${t('node.setting_transcode')}</span> <div class="node-setting-input"> <input type="checkbox" checked=${editSettings.transcode_incompatible_video} diff --git a/packages/meshbay-hub/tests/test_node_page_connection_processes.py b/packages/meshbay-hub/tests/test_node_page_connection_processes.py new file mode 100644 index 0000000..0342e6c --- /dev/null +++ b/packages/meshbay-hub/tests/test_node_page_connection_processes.py @@ -0,0 +1,38 @@ +""" +The Node page offers `connection_processes`, bounded by the machine's cores. + +The node refuses a number above its core count, so a field that let one be +typed would be a field whose Save fails. The ceiling comes with the settings +(`cpu_count`, which the node adds and ignores when it is sent back). +""" + +import re +from pathlib import Path + +STATIC = Path(__file__).resolve().parents[1] / "src" / "meshbay_hub" / "static" + + +def _field() -> str: + src = (STATIC / "node-page.js").read_text(encoding="utf-8") + at = src.index("t('node.setting_connection_processes')") + return src[at:src.index("</label>", at)] + + +def test_the_field_cannot_hold_more_than_the_cores(): + field = _field() + assert "max=${editSettings.cpu_count || 1}" in field + assert re.search(r"Math\.min\(Math\.max\(parseInt\(e\.target\.value\) \|\| 1, 1\), " + r"s\.cpu_count \|\| 1\)", field), ( + "a typed value is not held to the ceiling, only the spinner is") + + +def test_it_says_how_many_cores_there_are(): + assert "t('node.setting_unit_of', { n: editSettings.cpu_count || 1 })" in _field() + + +def test_every_language_names_it(): + for locale in sorted((STATIC / "locales").glob("*.js")): + text = locale.read_text(encoding="utf-8") + assert "'node.setting_connection_processes':" in text, locale.name + m = re.search(r"'node\.setting_unit_of': '([^']*)'", text) + assert m and "{n}" in m.group(1), locale.name |