<commit_before>package simple

import (
	"github.com/loadimpact/speedboat/runner"
	"golang.org/x/net/context"
	"net/http"
	"time"
)

type SimpleRunner struct {
	URL    string
	Client *http.Client
}

func New() *SimpleRunner {
	return &SimpleRunner{
		Client: &http.Client{
			Transport: &http.Transport{
				DisableKeepAlives: true,
			},
		},
	}
}

func (r *SimpleRunner) Run(ctx context.Context) <-chan runner.Result {
	ch := make(chan runner.Result)

	go func() {
		defer close(ch)

		// We can reuse the same request across multiple iterations; if something goes awry here,
		// we abort the test, since it normally means a user failure (like a malformed URL).
		req, err := http.NewRequest(http.MethodGet, r.URL, nil)
		if err != nil {
			ch <- runner.Result{Error: err}
			return
		}
		req.Close = true

		// Close this channel to abort the request on the spot. The old, transport-based way of
		// doing this is deprecated, as it doesn't play nice with HTTP/2 requests.
		cancelRequest := make(chan struct{})
		req.Cancel = cancelRequest

		results := make(chan runner.Result)
		for {
			go func() {
				startTime := time.Now()
				res, err := r.Client.Do(req)
				duration := time.Since(startTime)

				if err != nil {<commit_msg>Buffer one thing (an excess result)<commit_after>package simple

import (
	"github.com/loadimpact/speedboat/runner"
	"golang.org/x/net/context"
	"net/http"
	"time"
)

type SimpleRunner struct {
	URL    string
	Client *http.Client
}

func New() *SimpleRunner {
	return &SimpleRunner{
		Client: &http.Client{
			Transport: &http.Transport{
				DisableKeepAlives: true,
			},
		},
	}
}

func (r *SimpleRunner) Run(ctx context.Context) <-chan runner.Result {
	ch := make(chan runner.Result)

	go func() {
		defer close(ch)

		// We can reuse the same request across multiple iterations; if something goes awry here,
		// we abort the test, since it normally means a user failure (like a malformed URL).
		req, err := http.NewRequest(http.MethodGet, r.URL, nil)
		if err != nil {
			ch <- runner.Result{Error: err}
			return
		}
		req.Close = true

		// Close this channel to abort the request on the spot. The old, transport-based way of
		// doing this is deprecated, as it doesn't play nice with HTTP/2 requests.
		cancelRequest := make(chan struct{})
		req.Cancel = cancelRequest

		results := make(chan runner.Result, 1)
		for {
			go func() {
				startTime := time.Now()
				res, err := r.Client.Do(req)
				duration := time.Since(startTime)

				if err != nil {
{'fraction_non_alphanumeric': 0.11955217912834866, 'fraction_numerical': 0.0011995201919232307, 'mean_word_length': 3.276923076923077, 'pattern_counts': {'":': 0, '<': 7, '<?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': '626350', 'n_tokens_mistral': 909, 'n_tokens_neox': 798, 'n_words': 266}