diff options
author | embr <git@liclac.eu> | 2021-09-04 10:53:09 +0200 |
---|---|---|
committer | Kerstin <kerstin@erictapen.name> | 2021-09-21 16:35:17 +0200 |
commit | 8c1e6a8598a34107d27444219778f55b1ba45ff4 (patch) | |
tree | 26db1635db3518fb810a7f7c50cec6a362727c7c /nixos | |
parent | 2977fc3a107eb676803698d8b581abe84325524b (diff) | |
download | nixlib-8c1e6a8598a34107d27444219778f55b1ba45ff4.tar nixlib-8c1e6a8598a34107d27444219778f55b1ba45ff4.tar.gz nixlib-8c1e6a8598a34107d27444219778f55b1ba45ff4.tar.bz2 nixlib-8c1e6a8598a34107d27444219778f55b1ba45ff4.tar.lz nixlib-8c1e6a8598a34107d27444219778f55b1ba45ff4.tar.xz nixlib-8c1e6a8598a34107d27444219778f55b1ba45ff4.tar.zst nixlib-8c1e6a8598a34107d27444219778f55b1ba45ff4.zip |
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.
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/web-apps/mastodon.nix | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/nixos/modules/services/web-apps/mastodon.nix b/nixos/modules/services/web-apps/mastodon.nix index 5e24bd06ffdb..e3bc70791cfb 100644 --- a/nixos/modules/services/web-apps/mastodon.nix +++ b/nixos/modules/services/web-apps/mastodon.nix @@ -154,10 +154,15 @@ in { }; 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; default = 55002; }; + sidekiqThreads = lib.mkOption { + description = "Worker threads used by the mastodon-sidekiq service."; + type = lib.types.int; + default = 25; + }; vapidPublicKeyFile = lib.mkOption { description = '' @@ -524,9 +529,10 @@ in { wantedBy = [ "multi-user.target" ]; environment = env // { PORT = toString(cfg.sidekiqPort); + DB_POOL = toString cfg.sidekiqThreads; }; 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"; RestartSec = 20; EnvironmentFile = "/var/lib/mastodon/.secrets_env"; |