nixos/mastodon: Fix sidekiq's DB_POOL, add configurable concurrency
The `services.mastodon` module currently hardcodes sidekiq's concurrency to 25, but doesn't set a DB pool size, which defaults to 5 or the number of configured web threads. (This behaviour is very strange, and arguably a mastodon bug.) This also makes sidekiq's concurrency configurable, because 25 is a tad high for the hardware I'm running it on. (cherry picked from commit e8fd7792d1eeb4ea4943cc34525da1159ab50bc9)
This commit is contained in:
parent
cb996bbf84
commit
4f8927c417
@ -154,10 +154,15 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
sidekiqPort = lib.mkOption {
|
sidekiqPort = lib.mkOption {
|
||||||
description = "TCP port used by the mastodon-sidekiq service";
|
description = "TCP port used by the mastodon-sidekiq service.";
|
||||||
type = lib.types.port;
|
type = lib.types.port;
|
||||||
default = 55002;
|
default = 55002;
|
||||||
};
|
};
|
||||||
|
sidekiqThreads = lib.mkOption {
|
||||||
|
description = "Worker threads used by the mastodon-sidekiq service.";
|
||||||
|
type = lib.types.int;
|
||||||
|
default = 25;
|
||||||
|
};
|
||||||
|
|
||||||
vapidPublicKeyFile = lib.mkOption {
|
vapidPublicKeyFile = lib.mkOption {
|
||||||
description = ''
|
description = ''
|
||||||
@ -524,9 +529,10 @@ in {
|
|||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
environment = env // {
|
environment = env // {
|
||||||
PORT = toString(cfg.sidekiqPort);
|
PORT = toString(cfg.sidekiqPort);
|
||||||
|
DB_POOL = toString cfg.sidekiqThreads;
|
||||||
};
|
};
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = "${cfg.package}/bin/sidekiq -c 25 -r ${cfg.package}";
|
ExecStart = "${cfg.package}/bin/sidekiq -c ${toString cfg.sidekiqThreads} -r ${cfg.package}";
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
RestartSec = 20;
|
RestartSec = 20;
|
||||||
EnvironmentFile = "/var/lib/mastodon/.secrets_env";
|
EnvironmentFile = "/var/lib/mastodon/.secrets_env";
|
||||||
|
Loading…
Reference in New Issue
Block a user