nixos/tests/centrifugo: fix shards address list order in tests

Redis shards list must be consistent between Centrifugo nodes. Before
this change, NixOS tests were using invalid configurtaion since
shards[hash(ch)] may select different Redis shard instance on each
Centrifugo node. We don’t currently have any tests that exposed this
behavior though.
This commit is contained in:
Ivan Trubach 2024-03-29 15:15:07 +03:00
parent ed8d50fbfc
commit f27f3cdc10

View File

@ -24,12 +24,10 @@ in
engine = "redis";
# Connect to local Redis shard via Unix socket.
redis_address =
let
otherNodes = lib.take index nodes ++ lib.drop (index + 1) nodes;
in
map (name: "${name}:${toString redisPort}") otherNodes ++ [
let toRedisAddresses = map (name: "${name}:${toString redisPort}"); in
toRedisAddresses (lib.take index nodes) ++ [
"unix://${config.services.redis.servers.centrifugo.unixSocket}"
];
] ++ toRedisAddresses (lib.drop (index + 1) nodes);
usage_stats_disable = true;
api_insecure = true;
};