mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-08-14.git
synced 2024-08-15 00:53:20 +00:00
Add fix for index out of bounds during high load
This commit is contained in:
parent
4361ea9686
commit
f69f0b97f5
1 changed files with 13 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue