From 99d9c3a9003d98a34575b49c56cb26ac913f428a Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Tue, 5 Mar 2019 14:41:38 -0600 Subject: [PATCH] Fix rows for subscribe job --- src/invidious/jobs.cr | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/invidious/jobs.cr b/src/invidious/jobs.cr index 49745aba..50374601 100644 --- a/src/invidious/jobs.cr +++ b/src/invidious/jobs.cr @@ -158,11 +158,13 @@ def subscribe_to_feeds(db, logger, key, config) spawn do loop do db.query_all("SELECT id FROM channels WHERE CURRENT_TIMESTAMP - subscribed > '4 days'") do |rs| - ucid = rs.read(String) - response = subscribe_pubsub(ucid, key, config) + rs.each do + ucid = rs.read(String) + response = subscribe_pubsub(ucid, key, config) - if response.status_code >= 400 - logger.write("#{ucid} : #{response.body}\n") + if response.status_code >= 400 + logger.write("#{ucid} : #{response.body}\n") + end end end