fix(tubesync): add worker option

This commit is contained in:
514fpv 2024-02-22 11:24:59 +08:00
parent 6d3c62a8f0
commit f1f1254562
Signed by: koishi
SSH key fingerprint: SHA256:axz0uIzzY+5W19i7QOUuiw5LSqhKfCBKPf3L4xFRxLw

View file

@ -13,6 +13,12 @@ in {
description = "tubesync launcher package";
};
workers = mkOption {
type = with types; int;
default = 1;
description = "maximum amount of concurrent workers";
};
user = mkOption {
type = with types; str;
default = "tubesync";
@ -59,7 +65,6 @@ in {
config = mkIf cfg.enable {
systemd.services = let
env = {
PYTHONPATH = cfg.package.pythonPath;
GUNICORN_PID_FILE = "${cfg.stateDir}/run/gunicorn.pid";
GUNICORN_USER = cfg.user;
GUNICORN_GROUP = cfg.group;
@ -67,7 +72,9 @@ in {
CONFIG_BASE_DIR = cfg.stateDir;
DOWNLOADS_BASE_DIR = cfg.dataDir;
TUBESYNC_DEBUG = mkIf cfg.debug "True";
TUBESYNC_WORKERS = toString cfg.workers;
PYTHONPATH = cfg.package.pythonPath;
REDIS_CONNECTION = "redis+socket://"
+ "${cfg.stateDir}/run/redis.sock";
};