Skip to content

Commit

Permalink
add relaysBatchesOf function to implemenent rolling deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
jbgi committed Aug 11, 2020
1 parent 3e20964 commit f1c7a07
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions nix/topology-lib.nix
Expand Up @@ -133,4 +133,7 @@ pkgs: with pkgs; with lib; rec {
in withinOneHop relaysForRegion
) indexedRegions));

relaysBatchesOf = n:
let byRegions = attrValues (mapAttrs (_: rs: let irs = imap0 (i: mergeAttrs {inherit i;}) rs; in genList (i: (map (r: r.name) (filter (r: mod r.i n == i) irs))) n) (groupBy (r: r.region) globals.topology.relayNodes));
in genList (i: concatMap (rs: elemAt rs i) byRegions) n;
}

0 comments on commit f1c7a07

Please sign in to comment.