<commit_before>package http

import (
	"bytes"
	"container/list"
	"fmt"
	"log"
	"net"
	"net/http"
	"strings"
	"time"
)

type eventMessage struct {
	id    string
	event string
	data  string
}

type eventSource struct {
	sink           chan *eventMessage
	staled         chan *consumer
	add            chan *consumer
	close          chan bool
	timeout        time.Duration
	closeOnTimeout bool

	consumers *list.List
}

type Settings struct {
	// SetTimeout sets the write timeout for individual messages. The
	// default is 2 seconds.
	Timeout        time.Duration

	// CloseOnTimeout sets whether a write timeout should close the
	// connection or just drop the message.
	//
	// If the connection gets closed on a timeout, it's the client's
	// responsibility to re-establish a connection. If the connection
	// doesn't get closed, messages might get sent to a potentially dead
	// client.
	//
	// The default is true.
	CloseOnTimeout bool
}

func DefaultSettings() *settings {
	return &Settings{
		Timeout:        2 * time.Second,
		CloseOnTimeout: true,
	}
}

// EventSource interface provides methods for sending messages and closing all connections.
type EventSource interface {
	// it should implement ServerHTTP method
	http.Handler

	// send message to all consumers
	SendMessage(data, event, id string)

	// consumers count
	ConsumersCount() int<commit_msg>Typo in DefaultSettings return type<commit_after>package http

import (
	"bytes"
	"container/list"
	"fmt"
	"log"
	"net"
	"net/http"
	"strings"
	"time"
)

type eventMessage struct {
	id    string
	event string
	data  string
}

type eventSource struct {
	sink           chan *eventMessage
	staled         chan *consumer
	add            chan *consumer
	close          chan bool
	timeout        time.Duration
	closeOnTimeout bool

	consumers *list.List
}

type Settings struct {
	// SetTimeout sets the write timeout for individual messages. The
	// default is 2 seconds.
	Timeout        time.Duration

	// CloseOnTimeout sets whether a write timeout should close the
	// connection or just drop the message.
	//
	// If the connection gets closed on a timeout, it's the client's
	// responsibility to re-establish a connection. If the connection
	// doesn't get closed, messages might get sent to a potentially dead
	// client.
	//
	// The default is true.
	CloseOnTimeout bool
}

func DefaultSettings() *Settings {
	return &Settings{
		Timeout:        2 * time.Second,
		CloseOnTimeout: true,
	}
}

// EventSource interface provides methods for sending messages and closing all connections.
type EventSource interface {
	// it should implement ServerHTTP method
	http.Handler

	// send message to all consumers
	SendMessage(data, event, id string)

	// consumers count
	ConsumersCount() int
{'fraction_non_alphanumeric': 0.07340116279069768, 'fraction_numerical': 0.0014534883720930232, 'mean_word_length': 2.9956458635703918, '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': '4696651', 'n_tokens_mistral': 807, 'n_tokens_neox': 772, 'n_words': 311}