federation_sender worker type is deprecated

Enables replication listener if you have any workers for simplicity
send_federation is automatically set to false if federation_sender_instances is set so we don't have to do it
This commit is contained in:
Daniel Lovbrotte Olsen 2022-12-09 04:50:14 +01:00
parent f890dff8b0
commit 952bab1d6e
1 changed files with 4 additions and 16 deletions

View File

@ -145,7 +145,7 @@ in
options.worker_app = let options.worker_app = let
mapTypeApp = t: { mapTypeApp = t: {
"fed-sender" = "synapse.app.federation_sender"; "fed-sender" = "synapse.app.generic_worker";
"fed-receiver" = "synapse.app.generic_worker"; "fed-receiver" = "synapse.app.generic_worker";
}.${t}; }.${t};
defaultApp = if (!isAuto) defaultApp = if (!isAuto)
@ -154,9 +154,7 @@ in
in lib.mkOption { in lib.mkOption {
type = lib.types.enum [ type = lib.types.enum [
"synapse.app.generic_worker" "synapse.app.generic_worker"
"synapse.app.pusher"
"synapse.app.appservice" "synapse.app.appservice"
"synapse.app.federation_sender"
"synapse.app.media_repository" "synapse.app.media_repository"
"synapse.app.user_dir" "synapse.app.user_dir"
]; ];
@ -236,7 +234,7 @@ in
"federation_sender1" = { "federation_sender1" = {
settings = { settings = {
worker_name = "federation_sender1"; worker_name = "federation_sender1";
worker_app = "synapse.app.federation_sender"; worker_app = "synapse.app.generic_worker";
worker_replication_host = "127.0.0.1"; worker_replication_host = "127.0.0.1";
worker_replication_http_port = 9093; worker_replication_http_port = 9093;
@ -321,11 +319,7 @@ in
}; };
}); });
description = "List of ports that Synapse should listen on, their purpose and their configuration"; description = "List of ports that Synapse should listen on, their purpose and their configuration";
default = let default = [
enableReplication = lib.lists.any
(w: !(builtins.elem w.settings.worker_app [ "synapse.app.federation_sender" ]))
(builtins.attrValues cfg.workers.instances);
in [
{ {
port = 8008; port = 8008;
bind_addresses = [ "127.0.0.1" ]; bind_addresses = [ "127.0.0.1" ];
@ -334,7 +328,7 @@ in
{ names = [ "federation" ]; compress = false; } { names = [ "federation" ]; compress = false; }
]; ];
} }
(lib.mkIf enableReplication { (lib.mkIf (wcfg.instances != { }) {
port = 9093; port = 9093;
bind_addresses = [ "127.0.0.1" ]; bind_addresses = [ "127.0.0.1" ];
resources = [ resources = [
@ -437,12 +431,6 @@ in
]; ];
}; };
options.send_federation = lib.mkOption {
type = lib.types.bool;
description = "Disables sending of outbound federation transactions on the main process. Set to false if using federation senders";
default = cfg.settings.federation_sender_instances == [];
};
options.federation_sender_instances = lib.mkOption { options.federation_sender_instances = lib.mkOption {
type = lib.types.listOf lib.types.str; type = lib.types.listOf lib.types.str;
description = '' description = ''