mirror of
https://github.com/iv-org/invidious.git
synced 2025-04-25 16:16:26 +00:00
Pool: raise custom error when DB::PoolTimeout
This commit is contained in:
parent
f32c954859
commit
fbccb6a221
@ -72,7 +72,7 @@ module Invidious::ConnectionPool
|
||||
response = yield http_client
|
||||
rescue ex : DB::PoolTimeout
|
||||
# Failed to checkout a client
|
||||
raise ConnectionPool::Error.new(ex.message, cause: ex)
|
||||
raise ConnectionPool::PoolCheckoutError.new(ex.message)
|
||||
rescue ex
|
||||
# An error occurred with the client itself.
|
||||
# Delete the client from the pool and close the connection
|
||||
@ -131,6 +131,10 @@ module Invidious::ConnectionPool
|
||||
class Error < Exception
|
||||
end
|
||||
|
||||
# Raised when the pool failed to get a client in time
|
||||
class PoolCheckoutError < Error
|
||||
end
|
||||
|
||||
# Mapping of subdomain => Invidious::ConnectionPool::Pool
|
||||
# This is needed as we may need to access arbitrary subdomains of ytimg
|
||||
private YTIMG_POOLS = {} of String => ConnectionPool::Pool
|
||||
|
Loading…
x
Reference in New Issue
Block a user