<commit_before>package main

// Originally adapted from https://github.com/awslabs/service-discovery-ecs-dns
// This service is meant to run as a singleton instance in concert with redecs_agent
// running on AWS ECS instances. This service will check Redis regularly for active
// service updates and rewrite the A records for services to only contain recently
// active ip addresses.

import (
	"errors"
	"fmt"
	log "github.com/Sirupsen/logrus"
	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/route53"
	"gopkg.in/redis.v5"
	"os"
	"strconv"
	"strings"
	"time"
)

const checkInterval = 5 * time.Minute // how often to check Redis
const defaultTTL = 60                 // seconds
const fetchLast = 300                 // seconds

var DNSName = "servicediscovery.local"

func logErrorAndFail(err error) {
	if err != nil {
		// logrus calls os.exit(1)
		log.Fatal(err)
	}
}

func logErrorNoFatal(err error) {
	if err != nil {
		log.Error(err)
	}
}

type config struct {
	HostedZoneId string
	RedisHost    string
}

var configuration config

func getDNSHostedZoneId() (string, error) {
	r53 := route53.New(session.New())<commit_msg>Check things more often, increaes TTL<commit_after>package main

// Originally adapted from https://github.com/awslabs/service-discovery-ecs-dns
// This service is meant to run as a singleton instance in concert with redecs_agent
// running on AWS ECS instances. This service will check Redis regularly for active
// service updates and rewrite the A records for services to only contain recently
// active ip addresses.

import (
	"errors"
	"fmt"
	log "github.com/Sirupsen/logrus"
	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/route53"
	"gopkg.in/redis.v5"
	"os"
	"strconv"
	"strings"
	"time"
)

const checkInterval = 1 * time.Minute // how often to check Redis
const defaultTTL = 300                // seconds
const fetchLast = 300                 // seconds

var DNSName = "servicediscovery.local"

func logErrorAndFail(err error) {
	if err != nil {
		// logrus calls os.exit(1)
		log.Fatal(err)
	}
}

func logErrorNoFatal(err error) {
	if err != nil {
		log.Error(err)
	}
}

type config struct {
	HostedZoneId string
	RedisHost    string
}

var configuration config

func getDNSHostedZoneId() (string, error) {
	r53 := route53.New(session.New())
{'fraction_non_alphanumeric': 0.1103247293921732, 'fraction_numerical': 0.012073272273105746, 'mean_word_length': 3.3611615245009077, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '712044', 'n_tokens_mistral': 854, 'n_tokens_neox': 812, 'n_words': 234}