<commit_before>package redbutton

import "sync"

type Rooms struct {
	sync.RWMutex
	rooms map[string]*Room
}

func newRoomsList() *Rooms {
	return &Rooms{rooms: map[string]*Room{}}
}

func (this *Rooms) findRoom(id string) *Room {
	this.RLock()
	defer this.RUnlock()

	if room, ok := this.rooms[id]; ok {
		return room
	}
	return nil
}

func (this *Rooms) newRoom() *Room {
	this.Lock()
	defer this.Unlock()

	regenId:
	id := uniqueId()[:12]

	if _, ok := this.rooms[id]; ok {
		goto regenId
	}

	room := NewRoom()
	this.rooms[id] = room
	room.id = id
	return room
}<commit_msg>changed goto for infinite loop<commit_after>package redbutton

import "sync"

type Rooms struct {
	sync.RWMutex
	rooms map[string]*Room
}

func newRoomsList() *Rooms {
	return &Rooms{rooms: map[string]*Room{}}
}

func (this *Rooms) findRoom(id string) *Room {
	this.RLock()
	defer this.RUnlock()

	if room, ok := this.rooms[id]; ok {
		return room
	}
	return nil
}

func (this *Rooms) newRoom() *Room {
	this.Lock()
	defer this.Unlock()

	for {
		id := uniqueId()[:12]

		if _, ok := this.rooms[id]; ok {
			continue
		}

		room := NewRoom()
		this.rooms[id] = room
		room.id = id
		return room
	}

}
{'fraction_non_alphanumeric': 0.15195246179966043, 'fraction_numerical': 0.003395585738539898, 'mean_word_length': 3.716, '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': '6933931', 'n_tokens_mistral': 482, 'n_tokens_neox': 462, 'n_words': 121}