From 37b8c0241f1df42e7eb5beb512d32a2d9e6f7cf5 Mon Sep 17 00:00:00 2001 From: shortcutme Date: Sat, 30 Nov 2019 02:14:54 +0100 Subject: [PATCH] Db threads modify in config interface --- .../UiConfig/media/js/ConfigStorage.coffee | 14 +++++++++ plugins/UiConfig/media/js/all.js | 31 ++++++++++++++++++- src/Config.py | 7 +++-- 3 files changed, 49 insertions(+), 3 deletions(-) diff --git a/plugins/UiConfig/media/js/ConfigStorage.coffee b/plugins/UiConfig/media/js/ConfigStorage.coffee index 642bae45..9f35a91c 100644 --- a/plugins/UiConfig/media/js/ConfigStorage.coffee +++ b/plugins/UiConfig/media/js/ConfigStorage.coffee @@ -191,6 +191,20 @@ class ConfigStorage extends Class {title: "10 threads", value: 10} ] + section.items.push + key: "threads_db" + title: "Threads for database operations" + type: "select" + options: [ + {title: "Sync execution", value: 0} + {title: "1 thread", value: 1} + {title: "2 threads", value: 2} + {title: "3 threads", value: 3} + {title: "4 threads", value: 4} + {title: "5 threads", value: 5} + {title: "10 threads", value: 10} + ] + createSection: (title) => section = {} section.title = title diff --git a/plugins/UiConfig/media/js/all.js b/plugins/UiConfig/media/js/all.js index b2c09e39..43a91bc8 100644 --- a/plugins/UiConfig/media/js/all.js +++ b/plugins/UiConfig/media/js/all.js @@ -1539,7 +1539,7 @@ } ] }); - return section.items.push({ + section.items.push({ key: "threads_crypt", title: "Threads for cryptographic functions", type: "select", @@ -1568,6 +1568,35 @@ } ] }); + return section.items.push({ + key: "threads_db", + title: "Threads for database operations", + type: "select", + options: [ + { + title: "Sync execution", + value: 0 + }, { + title: "1 thread", + value: 1 + }, { + title: "2 threads", + value: 2 + }, { + title: "3 threads", + value: 3 + }, { + title: "4 threads", + value: 4 + }, { + title: "5 threads", + value: 5 + }, { + title: "10 threads", + value: 10 + } + ] + }); }; ConfigStorage.prototype.createSection = function(title) { diff --git a/src/Config.py b/src/Config.py index 7737ca2f..c57de0c7 100644 --- a/src/Config.py +++ b/src/Config.py @@ -22,7 +22,10 @@ class Config(object): self.keys_api_change_allowed = set([ "tor", "fileserver_port", "language", "tor_use_bridges", "trackers_proxy", "trackers", "trackers_file", "open_browser", "log_level", "fileserver_ip_type", "ip_external", "offline", - "threads_fs_read", "threads_fs_write", "threads_crypt" + "threads_fs_read", "threads_fs_write", "threads_crypt", "threads_db" + ]) + self.keys_restart_need = set([ + "tor", "fileserver_port", "fileserver_ip_type", "threads_fs_read", "threads_fs_write", "threads_crypt", "threads_db" ]) self.keys_restart_need = set(["tor", "fileserver_port", "fileserver_ip_type", "threads_fs_read", "threads_fs_write", "threads_crypt"]) self.start_dir = self.getStartDir() @@ -286,8 +289,8 @@ class Config(object): self.parser.add_argument('--threads_fs_read', help='Number of threads for file read operations', default=1, type=int) self.parser.add_argument('--threads_fs_write', help='Number of threads for file write operations', default=1, type=int) - self.parser.add_argument('--threads_db', help='Number of threads for database operations', default=1, type=int) self.parser.add_argument('--threads_crypt', help='Number of threads for cryptographic operations', default=2, type=int) + self.parser.add_argument('--threads_db', help='Number of threads for database operations', default=1, type=int) self.parser.add_argument("--download_optional", choices=["manual", "auto"], default="manual")