<commit_before>vcl 4.0;

import directors;

{% for backend in varnish_backend_hosts %}
  backend application_{{ loop.index }} {
    .host = "{{ backend }}";
    .port = "{{ varnish_backend_port }}";
    {% if varnish_health_checks_enabled %}
      .probe = {
        .url = '{{ varnish_health_check_url }}';
        .interval = {{ varnish_health_check_interval }};
        .timeout  = {{ varnish_health_check_timeout }};
        .window = {{ varnish_health_check_window }};
        .threshold = {{ varnish_health_check_threshold }};
      }
  }
{% endfor %}

sub vcl_init {
  new application = directors.round_robin();
  {% for backend in varnish_backend_hosts %}
    application.add_backend(application_{{ loop.index }});
  {% endfor %}
}
sub vcl_recv {
  set req.backend_hint = application.backend();
}

sub vcl_hit {
  if (obj.ttl > 0s) {
    return (deliver);
  }
  {% if varnish_health_checks_enabled %}
    if (!std.healthy(req.backend_hint) && (obj.ttl + obj.grace > 0s)) {
      return (deliver);
    } else {
      return (fetch);<commit_msg>Closing if tags is probably a good plan. Derp.<commit_after>vcl 4.0;

import directors;

{% for backend in varnish_backend_hosts %}
  backend application_{{ loop.index }} {
    .host = "{{ backend }}";
    .port = "{{ varnish_backend_port }}";
    {% if varnish_health_checks_enabled %}
      .probe = {
        .url = '{{ varnish_health_check_url }}';
        .interval = {{ varnish_health_check_interval }};
        .timeout  = {{ varnish_health_check_timeout }};
        .window = {{ varnish_health_check_window }};
        .threshold = {{ varnish_health_check_threshold }};
      }
    {% endif %}
  }
{% endfor %}

sub vcl_init {
  new application = directors.round_robin();
  {% for backend in varnish_backend_hosts %}
    application.add_backend(application_{{ loop.index }});
  {% endfor %}
}
sub vcl_recv {
  set req.backend_hint = application.backend();
}

sub vcl_hit {
  if (obj.ttl > 0s) {
    return (deliver);
  }
  {% if varnish_health_checks_enabled %}
    if (!std.healthy(req.backend_hint) && (obj.ttl + obj.grace > 0s)) {
      return (deliver);
    } else {
      return (fetch);
{'fraction_non_alphanumeric': 0.14597861459786146, 'fraction_numerical': 0.003719200371920037, 'mean_word_length': 3.0757575757575757, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '4492556', 'n_tokens_mistral': 782, 'n_tokens_neox': 734, 'n_words': 138}