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