<commit_before>package main

import (
	"log"
	"time"

	"github.com/Shopify/sarama"
)

func subLoop() {
	c, _ := sarama.NewConsumer([]string{
		"10.209.18.65:11004",
		"10.209.18.65:11004",
	}, sarama.NewConfig())
	s, _ := c.ConsumePartition(options.topic, 0, sarama.OffsetOldest)
	defer s.Close()

	loaded := false
	for {
		select {
		case <-time.After(time.Second * 3):
			if !loaded {
				loadedN = len(events)
				loaded = true
				if options.noUI {
					log.Println("events loaded, ready for new events...")
				}
				close(ready)
			}

		case msg := <-s.Messages():
			hook := decode(msg.Value)
			if options.webhookOnly {
				if h, ok := hook.(*Webhook); !ok {
					continue
				} else if options.project != "" && options.project != h.Repository.Name {
					continue
				}
			}

			if options.syshookOnly {
				if _, ok := hook.(*Webhook); ok {
					continue
				}
			}

			if options.noUI {
				if loaded {
					displayNotify(eventContent(msg), "Glass")
				}

				continue
			}

			lock.Lock()
			events = append(events, hook)
			lock.Unlock()
			if loaded {<commit_msg>display new event in console log<commit_after>package main

import (
	"log"
	"time"

	"github.com/Shopify/sarama"
)

func subLoop() {
	c, _ := sarama.NewConsumer([]string{
		"10.209.18.65:11004",
		"10.209.18.65:11004",
	}, sarama.NewConfig())
	s, _ := c.ConsumePartition(options.topic, 0, sarama.OffsetOldest)
	defer s.Close()

	loaded := false
	for {
		select {
		case <-time.After(time.Second * 3):
			if !loaded {
				loadedN = len(events)
				loaded = true
				if options.noUI {
					log.Println("events loaded, ready for new events...")
				}
				close(ready)
			}

		case msg := <-s.Messages():
			hook := decode(msg.Value)
			if options.webhookOnly {
				if h, ok := hook.(*Webhook); !ok {
					continue
				} else if options.project != "" && options.project != h.Repository.Name {
					continue
				}
			}

			if options.syshookOnly {
				if _, ok := hook.(*Webhook); ok {
					continue
				}
			}

			if options.noUI {
				if loaded {
					event := eventContent(msg)
					log.Println(event)
					displayNotify(event, "Glass")
				}

				continue
			}

			lock.Lock()
			events = append(events, hook)
			lock.Unlock()
			if loaded {
{'fraction_non_alphanumeric': 0.15367282559711581, 'fraction_numerical': 0.027039206849932402, 'mean_word_length': 2.5294117647058822, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, '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': '895116', 'n_tokens_mistral': 1043, 'n_tokens_neox': 790, 'n_words': 170}