diff options
| author | Omar Roth <omarroth@hotmail.com> | 2019-02-15 17:13:52 -0600 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2019-02-15 17:13:52 -0600 |
| commit | c099a5ad2e42616ee96a5da41cf27083606ac692 (patch) | |
| tree | 4d09db0a39c5b5097a4947695ff076c5e8b147c7 | |
| parent | 9df77707d34cbcacb82469bf91fe1f498808a6a1 (diff) | |
| download | invidious-c099a5ad2e42616ee96a5da41cf27083606ac692.tar.gz invidious-c099a5ad2e42616ee96a5da41cf27083606ac692.tar.bz2 invidious-c099a5ad2e42616ee96a5da41cf27083606ac692.zip | |
Speed up manage_subscriptions
| -rw-r--r-- | src/invidious.cr | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/invidious.cr b/src/invidious.cr index 285d4394..93f63dfe 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -1373,12 +1373,7 @@ get "/subscription_manager" do |env| format = env.params.query["format"]? format ||= "rss" - subscriptions = [] of InvidiousChannel - user.subscriptions.each do |ucid| - if channel = PG_DB.query_one?("SELECT * FROM channels WHERE id = $1", ucid, as: InvidiousChannel) - subscriptions << channel - end - end + subscriptions = PG_DB.query_all("SELECT * FROM channels WHERE id = ANY('{#{user.subscriptions.join(",")}}')", as: InvidiousChannel) subscriptions.sort_by! { |channel| channel.author.downcase } if action_takeout |
