<commit_before>package mem

import (
	"time"

	"golang.org/x/net/context"
)

// handleWithLatency allows introduction of artificial latency while handling context cancellation.
// The method first wait for the given latency while monitoring ctx.Done. If context is canceled
// during the wait, the context error is returned.
// If latency passed, the handler is executed and it's error output is returned.
func handleWithLatency(latency time.Duration, ctx context.Context, handler func() error) error {<commit_msg>Optimize path with no latency<commit_after>package mem

import (
	"time"

	"golang.org/x/net/context"
)

// handleWithLatency allows introduction of artificial latency while handling context cancellation.
// The method first wait for the given latency while monitoring ctx.Done. If context is canceled
// during the wait, the context error is returned.
// If latency passed, the handler is executed and it's error output is returned.
func handleWithLatency(latency time.Duration, ctx context.Context, handler func() error) error {
	if latency == 0 {
		return handler()
	}

{'fraction_non_alphanumeric': 0.07550644567219153, 'fraction_numerical': 0.0009208103130755065, 'mean_word_length': 4.48989898989899, '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': '1713258', 'n_tokens_mistral': 295, 'n_tokens_neox': 273, 'n_words': 129}