<commit_before>package main

import (
  "os"
	"log"
  "fmt"
  "flag"
  "github.com/nyaruka/junebug/cfg"
  "github.com/nyaruka/junebug/http"
  "github.com/nyaruka/junebug/conn"
  "github.com/nyaruka/junebug/msg"
  "github.com/nyaruka/junebug/disp"
)

func main() {
    settings := flag.String("settings", "", "Our settings file")
    flag.Parse()

    // they didn't pass in settings parameter, print some help
    if *settings == "" {
      fmt.Println("\nUsage: junebug --settings=junebug.conf\n")
      fmt.Println("Example configuration file:\n")
      fmt.Println(cfg.GetSampleConfig())
      fmt.Println()
      os.Exit(1)
    }

    _, err := cfg.ReadConfig(*settings)
    if err != nil {
      fmt.Println("Error reading Junebug settings:")
      fmt.Println(err.Error())
      os.Exit(1)
    }

    // load our connection configurations
    configs, err := conn.ReadConnectionConfigs(cfg.Config.Directories.Connections)
    if err != nil {
      log.Fatal(err)
    }

    // for each one, create a real connection
    // TODO: this whole block belongs somewhere else
    connections := make(map[string]conn.Connection)
    for i:=0; i<len(configs); i++ {
      config := configs[i]

      // create a dispatcher for this connection
      dispatcher := disp.CreateDispatcher(config.NumSenders, config.NumReceivers)

      // and create our actual connection
      connection := conn.CreateConnection(config, dispatcher)

      // start everything
      dispatcher.Start()
      connection.Start()

      // dispatch any backlog of outgoing messages
      outgoing, err := msg.ReadOutboxMsgs(config.Uuid)
      if err != nil {<commit_msg>Add option to configure GOMAXPROCS<commit_after>package main

import (
  "os"
	"log"
  "fmt"
  "flag"
  "github.com/nyaruka/junebug/cfg"
  "github.com/nyaruka/junebug/http"
  "github.com/nyaruka/junebug/conn"
  "github.com/nyaruka/junebug/msg"
  "github.com/nyaruka/junebug/disp"
  "runtime"
)

func main() {
    settings := flag.String("settings", "", "Our settings file")
    procs := flag.Int("procs", 4, "Max number of processors to use")
    flag.Parse()

    // they didn't pass in settings parameter, print some help
    if *settings == "" {
      fmt.Println("\nUsage: junebug --settings=junebug.conf\n")
      fmt.Println("Example configuration file:\n")
      fmt.Println(cfg.GetSampleConfig())
      fmt.Println()
      os.Exit(1)
    }

    _, err := cfg.ReadConfig(*settings)
    if err != nil {
      fmt.Println("Error reading Junebug settings:")
      fmt.Println(err.Error())
      os.Exit(1)
    }

    runtime.GOMAXPROCS(*procs)

    // load our connection configurations
    configs, err := conn.ReadConnectionConfigs(cfg.Config.Directories.Connections)
    if err != nil {
      log.Fatal(err)
    }

    // for each one, create a real connection
    // TODO: this whole block belongs somewhere else
    connections := make(map[string]conn.Connection)
    for i:=0; i<len(configs); i++ {
      config := configs[i]

      // create a dispatcher for this connection
      dispatcher := disp.CreateDispatcher(config.NumSenders, config.NumReceivers)

      // and create our actual connection
      connection := conn.CreateConnection(config, dispatcher)

      // start everything
      dispatcher.Start()
      connection.Start()

      // dispatch any backlog of outgoing messages
      outgoing, err := msg.ReadOutboxMsgs(config.Uuid)
      if err != nil {
{'fraction_non_alphanumeric': 0.12945645821157217, 'fraction_numerical': 0.0020455873758036236, 'mean_word_length': 2.846067415730337, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2545930', 'n_tokens_mistral': 1104, 'n_tokens_neox': 1078, 'n_words': 249}