<commit_before>package main

import "time"
import "fmt"

func main() {

	requests := make(chan int, 5)
	for i := 1; i <= 5; i++ {
		requests <- i
	}
	close(requests)

	limiter := time.Tick(time.Millisecond * 500)

	for req := range requests {
		<-limiter
		fmt.Println("request", req, time.Now())
	}

}<commit_msg>rate limiting comments<commit_after>package main

import "time"
import "fmt"

func main() {

	requests := make(chan int, 5)
	for i := 1; i <= 5; i++ {
		requests <- i
	}
	close(requests)

	limiter := time.Tick(time.Millisecond * 500)

	/*
	 * By blocking on a receive from the limiter channel
	 * before serving each request, we limit ourselves
	 * to 1 request every 200 milliseconds.
	 */
	for req := range requests {
		<-limiter
		fmt.Println("request", req, time.Now())
	}

}
{'fraction_non_alphanumeric': 0.1450189155107188, 'fraction_numerical': 0.0201765447667087, 'mean_word_length': 3.411111111111111, 'pattern_counts': {'":': 0, '<': 9, '<?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': '642905', 'n_tokens_mistral': 308, 'n_tokens_neox': 269, 'n_words': 88}