<commit_before>package evedata

import (
	"encoding/gob"
	"net"
	"os"

	"log"
	"net/http"
	"time"

	"github.com/antihax/eveapi"
	"github.com/antihax/evedata/appContext"
	"github.com/antihax/evedata/config"
	"github.com/antihax/evedata/discord"
	"github.com/antihax/evedata/eveConsumer"

	"github.com/antihax/evedata/models"
	"github.com/antihax/goesi"

	"github.com/garyburd/redigo/redis"
	"github.com/gorilla/context"
	"github.com/gregjones/httpcache"
	httpredis "github.com/gregjones/httpcache/redis"
	"golang.org/x/oauth2"
	gsr "gopkg.in/boj/redistore.v1"
)

var ctx appContext.AppContext

// GetContext Returns the global appContext for EVEData Server
func GetContext() *appContext.AppContext {
	return &ctx
}

// GoServer Runs the EVEData Server
func GoServer() {
	var err error

	// Read configuation.
	if ctx.Conf, err = config.ReadConfig(); err != nil {
		log.Fatalf("Error reading configuration: %v", err)
	}

	// Build the redis pool
	ctx.Cache = &redis.Pool{
		MaxIdle:     50,
		MaxActive:   0,
		Wait:        false,
		IdleTimeout: 90 * time.Second,
		Dial: func() (redis.Conn, error) {
			c, err := redis.Dial("tcp", ctx.Conf.Redis.Address)
			if err != nil {
				return nil, err
			}
			if ctx.Conf.Redis.Password != "" {
				if _, err := c.Do("AUTH", ctx.Conf.Redis.Password); err != nil {
					c.Close()
					return nil, err
				}
			}
			return c, err
		},
	}

	// Create a Redis http client for the CCP APIs.
	transportCache := httpcache.NewTransport(httpredis.NewWithClient(ctx.Cache.Get()))

	// Attach a basic transport with our chained custom transport.
	transportCache.Transport = &transport{&http.Transport{
		MaxIdleConns: 0,
		DialContext: (&net.Dialer{
			Timeout:   30 * time.Second,<commit_msg>add flush back.. leave commented out<commit_after>package evedata

import (
	"encoding/gob"
	"net"
	"os"

	"log"
	"net/http"
	"time"

	"github.com/antihax/eveapi"
	"github.com/antihax/evedata/appContext"
	"github.com/antihax/evedata/config"
	"github.com/antihax/evedata/discord"
	"github.com/antihax/evedata/eveConsumer"

	"github.com/antihax/evedata/models"
	"github.com/antihax/goesi"

	"github.com/garyburd/redigo/redis"
	"github.com/gorilla/context"
	"github.com/gregjones/httpcache"
	httpredis "github.com/gregjones/httpcache/redis"
	"golang.org/x/oauth2"
	gsr "gopkg.in/boj/redistore.v1"
)

var ctx appContext.AppContext

// GetContext Returns the global appContext for EVEData Server
func GetContext() *appContext.AppContext {
	return &ctx
}

// GoServer Runs the EVEData Server
func GoServer() {
	var err error

	// Read configuation.
	if ctx.Conf, err = config.ReadConfig(); err != nil {
		log.Fatalf("Error reading configuration: %v", err)
	}

	// Build the redis pool
	ctx.Cache = &redis.Pool{
		MaxIdle:     50,
		MaxActive:   0,
		Wait:        false,
		IdleTimeout: 90 * time.Second,
		Dial: func() (redis.Conn, error) {
			c, err := redis.Dial("tcp", ctx.Conf.Redis.Address)
			if err != nil {
				return nil, err
			}
			if ctx.Conf.Redis.Password != "" {
				if _, err := c.Do("AUTH", ctx.Conf.Redis.Password); err != nil {
					c.Close()
					return nil, err
				}
			}
			return c, err
		},
	}

	/*r := ctx.Cache.Get()
	r.Do("FLUSHALL")
	r.Close()*/

	// Create a Redis http client for the CCP APIs.
	transportCache := httpcache.NewTransport(httpredis.NewWithClient(ctx.Cache.Get()))

	// Attach a basic transport with our chained custom transport.
	transportCache.Transport = &transport{&http.Transport{
		MaxIdleConns: 0,
		DialContext: (&net.Dialer{
			Timeout:   30 * time.Second,
{'fraction_non_alphanumeric': 0.1424113475177305, 'fraction_numerical': 0.005673758865248227, 'mean_word_length': 3.4689480354879594, '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': '1022209', 'n_tokens_mistral': 1470, 'n_tokens_neox': 1354, 'n_words': 280}