<commit_before>package network

import (
	"context"
	"sync"
	"time"

	"github.com/pkg/errors"
	"github.com/sirupsen/logrus"
	"github.com/verath/archipelago/lib/common"
	"golang.org/x/time/rate"
)

const (
	// clientReadBufferSize is the max number of messages buffered
	// in the readQueue.
	clientReadBufferSize = 32

	// clientWriteBufferSize is the max number of messages buffered
	// in the writeQueue.
	clientWriteBufferSize = 32

	// clientShutdownWait is the max time the client will wait for the
	// underlying connection to cleanly shutdown before force closing.
	clientShutdownWait = 10 * time.Second

	// clientReadLimitRate is the rate limit bucket refil rate in seconds.
	clientReadLimitRate = rate.Limit(10)

	// clientReadLimitBurst is the rate limit bucket size.
	clientReadLimitBurst = 10
)<commit_msg>Refill rate is token/s, not seconds.<commit_after>package network

import (
	"context"
	"sync"
	"time"

	"github.com/pkg/errors"
	"github.com/sirupsen/logrus"
	"github.com/verath/archipelago/lib/common"
	"golang.org/x/time/rate"
)

const (
	// clientReadBufferSize is the max number of messages buffered
	// in the readQueue.
	clientReadBufferSize = 32

	// clientWriteBufferSize is the max number of messages buffered
	// in the writeQueue.
	clientWriteBufferSize = 32

	// clientShutdownWait is the max time the client will wait for the
	// underlying connection to cleanly shutdown before force closing.
	clientShutdownWait = 10 * time.Second

	// clientReadLimitRate is the rate limit bucket refill rate [token/s].
	clientReadLimitRate = rate.Limit(10)

	// clientReadLimitBurst is the rate limit bucket size.
	clientReadLimitBurst = 10
)
{'fraction_non_alphanumeric': 0.08428657435279951, 'fraction_numerical': 0.012040939193257074, 'mean_word_length': 4.006024096385542, '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': '2603180', 'n_tokens_mistral': 554, 'n_tokens_neox': 512, 'n_words': 164}