<commit_before>package main

import (
	"fmt"
	"os"
	"strconv"
	"time"

	"github.com/garyburd/redigo/redis"
	"gopkg.in/olivere/elastic.v3"
)

func setupRedis(config string) redis.Conn {
	redisClient, err := redis.Dial("tcp", config)
	if err != nil {
		panic(err)
	}
	return redisClient
}

func setupElasticsearch(config string) *elastic.Client {
	elasticsearchClient, err := elastic.NewClient(
		elastic.SetURL("http://"+config),
		elastic.SetHealthcheckTimeout(15*time.Second),
	)
	if err != nil {
		// Handle error
		panic(err)
	}
	exists, err := elasticsearchClient.IndexExists("requestbin").Do()
	if err != nil {
		panic(err)
	}
	if !exists {
		_, err = elasticsearchClient.CreateIndex("requestbin").Do()
		if err != nil {
			// Handle error
			panic(err)
		}
	}
	return elasticsearchClient
}

func main() {
	fmt.Println("starting")

	redisClient := setupRedis(os.Getenv("REDIS"))
	defer redisClient.Close()

	elasticsearchClient := setupElasticsearch(os.Getenv("ELASTICSEARCH"))

	elasticsearchWriter := ElasticsearchRequestWriter{client: elasticsearchClient}

	root := os.Getenv("ROOT")
	httpPort, err := strconv.Atoi(os.Getenv("PORT"))
	if err != nil {
		panic(fmt.Sprintf("Invalid port %s", os.Getenv("PORT")))
	}

	redisWriter := RedisHttpRequestWriter{client: redisClient}
	startLoggingHttpServer(httpPort, redisWriter, elasticsearchWriter)
	startAdminHttpServer(httpPort+1, root+"/static/", redisClient)
	startKibanaProxy(httpPort+2, os.Getenv("KIBANA"), root+"/passwd")

	tcpPort := os.Getenv("TCP_PORT")
	startTCPServer(tcpPort, elasticsearchWriter)
	fmt.Println("started")
}
<commit_msg>Use the startup timeout for ES instead of the normal one to wait<commit_after>package main

import (
	"fmt"
	"os"
	"strconv"
	"time"

	"github.com/garyburd/redigo/redis"
	"gopkg.in/olivere/elastic.v3"
)

func setupRedis(config string) redis.Conn {
	redisClient, err := redis.Dial("tcp", config)
	if err != nil {
		panic(err)
	}
	return redisClient
}

func setupElasticsearch(config string) *elastic.Client {
	elasticsearchClient, err := elastic.NewClient(
		elastic.SetURL("http://"+config),
		elastic.SetHealthcheckTimeoutStartup(30*time.Second),
	)
	if err != nil {
		// Handle error
		panic(err)
	}
	exists, err := elasticsearchClient.IndexExists("requestbin").Do()
	if err != nil {
		panic(err)
	}
	if !exists {
		_, err = elasticsearchClient.CreateIndex("requestbin").Do()
		if err != nil {
			// Handle error
			panic(err)
		}
	}
	return elasticsearchClient
}

func main() {
	fmt.Println("starting")

	redisClient := setupRedis(os.Getenv("REDIS"))
	defer redisClient.Close()

	elasticsearchClient := setupElasticsearch(os.Getenv("ELASTICSEARCH"))

	elasticsearchWriter := ElasticsearchRequestWriter{client: elasticsearchClient}

	root := os.Getenv("ROOT")
	httpPort, err := strconv.Atoi(os.Getenv("PORT"))
	if err != nil {
		panic(fmt.Sprintf("Invalid port %s", os.Getenv("PORT")))
	}

	redisWriter := RedisHttpRequestWriter{client: redisClient}
	startLoggingHttpServer(httpPort, redisWriter, elasticsearchWriter)
	startAdminHttpServer(httpPort+1, root+"/static/", redisClient)
	startKibanaProxy(httpPort+2, os.Getenv("KIBANA"), root+"/passwd")

	tcpPort := os.Getenv("TCP_PORT")
	startTCPServer(tcpPort, elasticsearchWriter)
	fmt.Println("started")
}

{'fraction_non_alphanumeric': 0.14610190300798034, 'fraction_numerical': 0.003069367710251688, 'mean_word_length': 5.328155339805825, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1279285', 'n_tokens_mistral': 1203, 'n_tokens_neox': 1154, 'n_words': 208}