Skip to content

Commit

Permalink
Shards: Update database dependencies (#5034)
Browse files Browse the repository at this point in the history
No related issue
  • Loading branch information
SamantazFox committed Nov 8, 2024
2 parents a760b69 + 711d52d commit 09f5485
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
6 changes: 3 additions & 3 deletions shard.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ shards:

db:
git: https://github.com/crystal-lang/crystal-db.git
version: 0.10.1
version: 0.13.1

exception_page:
git: https://github.com/crystal-loot/exception_page.git
Expand All @@ -34,7 +34,7 @@ shards:

pg:
git: https://github.com/will/crystal-pg.git
version: 0.24.0
version: 0.28.0

protodec:
git: https://github.com/iv-org/protodec.git
Expand All @@ -50,5 +50,5 @@ shards:

sqlite3:
git: https://github.com/crystal-lang/crystal-sqlite3.git
version: 0.18.0
version: 0.21.0

4 changes: 2 additions & 2 deletions shard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ targets:
dependencies:
pg:
github: will/crystal-pg
version: ~> 0.24.0
version: ~> 0.28.0
sqlite3:
github: crystal-lang/crystal-sqlite3
version: ~> 0.18.0
version: ~> 0.21.0
kemal:
github: kemalcr/kemal
version: ~> 1.1.2
Expand Down
10 changes: 8 additions & 2 deletions src/invidious/yt_backend/connection_pool.cr
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ struct YoutubeConnectionPool
response = yield conn
rescue ex
conn.close

conn = make_client(url, force_resolve: true)

response = yield conn
Expand All @@ -34,7 +33,14 @@ struct YoutubeConnectionPool
end

private def build_pool
DB::Pool(HTTP::Client).new(initial_pool_size: 0, max_pool_size: capacity, max_idle_pool_size: capacity, checkout_timeout: timeout) do
options = DB::Pool::Options.new(
initial_pool_size: 0,
max_pool_size: capacity,
max_idle_pool_size: capacity,
checkout_timeout: timeout
)

DB::Pool(HTTP::Client).new(options) do
next make_client(url, force_resolve: true)
end
end
Expand Down

0 comments on commit 09f5485

Please sign in to comment.