<commit_before>package notifications

import (
	"encoding/json"
	"time"

	log "github.com/Sirupsen/logrus"
	"github.com/fzzy/radix/redis"
)

type Notification struct {
	Repository string `json:"repository"`
	Owner      string `json:"owner"`
	Commit     string `json:"commit"`
	Branch     string `json:"branch"`
}

func init() {
	log.SetLevel(log.DebugLevel)
}

func (n Notification) Publish() {
	var err error
	var conn *redis.Client
	var channel string
	var message string
	var marshalled []byte
	var timeout time.Duration

	timeout = time.Duration(10) * time.Second

	conn, err = redis.DialTimeout("tcp", "127.0.0.1:6379", timeout)

	if err != nil {
		log.Fatal(err)
	} else {
		log.Info("Established connection to redis")
	}

	defer conn.Close()

	marshalled, err = json.Marshal(n)

	if err != nil {
		log.Fatal(err)
	}

	message = string(marshalled)

	channel = "iago." + n.Owner + "." + n.Repository

	conn.Cmd("publish", channel, message)

	log.WithFields(log.Fields{
		"message": message,
		"channel": channel,
	}).Info("Published notification")
}
<commit_msg>Fixed the channel used when publishing notifications<commit_after>package notifications

import (
	"encoding/json"
	"time"

	log "github.com/Sirupsen/logrus"
	"github.com/fzzy/radix/redis"
)

type Notification struct {
	Repository string `json:"repository"`
	Owner      string `json:"owner"`
	Commit     string `json:"commit"`
	Branch     string `json:"branch"`
}

func init() {
	log.SetLevel(log.DebugLevel)
}

func (n Notification) Publish() {
	var err error
	var conn *redis.Client
	var channel string
	var message string
	var marshalled []byte
	var timeout time.Duration

	timeout = time.Duration(10) * time.Second

	conn, err = redis.DialTimeout("tcp", "127.0.0.1:6379", timeout)

	if err != nil {
		log.Fatal(err)
	} else {
		log.Info("Established connection to redis")
	}

	defer conn.Close()

	marshalled, err = json.Marshal(n)

	if err != nil {
		log.Fatal(err)
	}

	message = string(marshalled)

	channel = "milou." + n.Owner + "." + n.Repository

	conn.Cmd("publish", channel, message)

	log.WithFields(log.Fields{
		"message": message,
		"channel": channel,
	}).Info("Published notification")
}

{'fraction_non_alphanumeric': 0.140754369825207, 'fraction_numerical': 0.011039558417663294, 'mean_word_length': 4.0, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '3195478', 'n_tokens_mistral': 805, 'n_tokens_neox': 752, 'n_words': 186}