mirror of
				https://gitea.invidious.io/iv-org/invidious
				synced 2025-06-05 23:29:12 +02:00 
			
		
		
		
	Add fix for index out of bounds during high load
This commit is contained in:
		| @@ -237,3 +237,16 @@ class HTTP::Client | ||||
|     response | ||||
|   end | ||||
| end | ||||
|  | ||||
| struct Crystal::ThreadLocalValue(T) | ||||
|   @values = Hash(Thread, T).new | ||||
|  | ||||
|   def get(&block : -> T) | ||||
|     th = Thread.current | ||||
|     if !@values[th]? | ||||
|       @values[th] = yield | ||||
|     else | ||||
|       @values[th] | ||||
|     end | ||||
|   end | ||||
| end | ||||
|   | ||||
		Reference in New Issue
	
	Block a user