mirror of
				https://github.com/zulip/zulip.git
				synced 2025-10-31 12:03:46 +00:00 
			
		
		
		
	stream_color: Make stream color assignment more efficient.
We now let color_data keep its own state for unused_colors, so that we longer have to pass in a large list of unused_colors every time we want to assign a new stream color. This mostly matters at startup, where we might be cycling through 5000 streams. We claim all the unused colors up front. Each operation now has an upper bound of expensiveness, where the worst case scenario is basically popping off the first element of a list of <= 24 colors. The algorithm is now deterministic, too, to make it easier to test. It's unclear whether random color assignment ever had much benefit, and it made unit testing the algorithm difficult. Now we have 100% line coverage. Fixes part of #10902.
This commit is contained in:
		| @@ -31,6 +31,7 @@ enforce_fully_covered = { | ||||
|     'static/js/buddy_data.js', | ||||
|     'static/js/buddy_list.js', | ||||
|     'static/js/channel.js', | ||||
|     'static/js/color_data.js', | ||||
|     'static/js/colorspace.js', | ||||
|     'static/js/common.js', | ||||
|     'static/js/components.js', | ||||
|   | ||||
		Reference in New Issue
	
	Block a user