<commit_before># DO NOT EDIT - This file is being maintained by Chef

upstream tile_cache_backend {
  server 127.0.0.1:8080;
  server 127.0.0.2:8080;

  # Add the other caches to relieve pressure if local squid failing
  # Balancer: round-robin
<% server_weight = 10 -%>
<% @node[:tilecache][:tile_siblings].each do |cache_peer| -%>
<% @caches.each do |cache| -%>
<% if cache_peer == cache[:fqdn] -%>
<% if cache[:hostname] != node[:hostname] -%>
<% cache.ipaddresses(:family => :inet, :role => :external).sort.each do |address| -%>
  server <%= address %>:80 weight=<%= server_weight.div(5) %>; # Server <%= cache[:hostname] %>
<% server_weight += 5 -%>
<% end -%>
<% end -%>
<% end -%>
<% end -%>
<% end -%>
}

# Geo Map of tile caches
geo $tile_cache {
  default 0;
<% @caches.each do |cache| -%>
<% cache.ipaddresses(:family => :inet, :role => :external).sort.each do |address| -%>
  <%= address %> 1; # <%= cache[:hostname] %>
<% end -%>
<% end -%>
}

# Rates table based on current cookie value
# map $cookie__osm_totp_token $limit_rate_qos {
#  include /etc/nginx/conf.d/tile_qos_rates.map;
# }

# Set-Cookie table based on current cookie value
# map $cookie__osm_totp_token $cookie_qos_token_set {
#  include /etc/nginx/conf.d/tile_qos_cookies.map;
# }
<commit_msg>tilecache: fix weight calculation<commit_after># DO NOT EDIT - This file is being maintained by Chef

upstream tile_cache_backend {
  server 127.0.0.1:8080;
  server 127.0.0.2:8080;

  # Add the other caches to relieve pressure if local squid failing
  # Balancer: round-robin
<% server_weight = 10 -%>
<% @node[:tilecache][:tile_siblings].each do |cache_peer| -%>
<% @caches.each do |cache| -%>
<% if cache_peer == cache[:fqdn] -%>
<% if cache[:hostname] != node[:hostname] -%>
<% cache.ipaddresses(:family => :inet, :role => :external).sort.each do |address| -%>
  server <%= address %>:80 weight=<%= server_weight.div(10) %>; # Server <%= cache[:hostname] %>
<% server_weight += 5 -%>
<% end -%>
<% end -%>
<% end -%>
<% end -%>
<% end -%>
}

# Geo Map of tile caches
geo $tile_cache {
  default 0;
<% @caches.each do |cache| -%>
<% cache.ipaddresses(:family => :inet, :role => :external).sort.each do |address| -%>
  <%= address %> 1; # <%= cache[:hostname] %>
<% end -%>
<% end -%>
}

# Rates table based on current cookie value
# map $cookie__osm_totp_token $limit_rate_qos {
#  include /etc/nginx/conf.d/tile_qos_rates.map;
# }

# Set-Cookie table based on current cookie value
# map $cookie__osm_totp_token $cookie_qos_token_set {
#  include /etc/nginx/conf.d/tile_qos_cookies.map;
# }

{'fraction_non_alphanumeric': 0.1897156213478769, 'fraction_numerical': 0.022204908453447605, 'mean_word_length': 4.115537848605578, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5041474', 'n_tokens_mistral': 1061, 'n_tokens_neox': 965, 'n_words': 225}