From 9ba3e1cdb45cc4eafc33c02e773aaee286aac551 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Sun, 26 Sep 2021 23:31:14 +0200 Subject: [PATCH 1/2] Decrease channel refresh frequency (1 min -> 1 h) This is a temporary fix to reduce load on instances with many channels and avoid IP being flagged by Google. --- src/invidious/jobs/refresh_channels_job.cr | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/invidious/jobs/refresh_channels_job.cr b/src/invidious/jobs/refresh_channels_job.cr index fbe6d381..0adb4b5a 100644 --- a/src/invidious/jobs/refresh_channels_job.cr +++ b/src/invidious/jobs/refresh_channels_job.cr @@ -58,8 +58,9 @@ class Invidious::Jobs::RefreshChannelsJob < Invidious::Jobs::BaseJob end end - LOGGER.debug("RefreshChannelsJob: Done, sleeping for one minute") - sleep 1.minute + # TODO: make this configurable + LOGGER.debug("RefreshChannelsJob: Done, sleeping for one hour") + sleep 1.hour Fiber.yield end end From c6f088d6caa5a7387883d94144d761489e17cadf Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Fri, 8 Oct 2021 18:39:02 +0200 Subject: [PATCH 2/2] Reduce refresh delay, increase backoff start duration --- src/invidious/jobs/refresh_channels_job.cr | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/invidious/jobs/refresh_channels_job.cr b/src/invidious/jobs/refresh_channels_job.cr index 0adb4b5a..2321e964 100644 --- a/src/invidious/jobs/refresh_channels_job.cr +++ b/src/invidious/jobs/refresh_channels_job.cr @@ -9,7 +9,7 @@ class Invidious::Jobs::RefreshChannelsJob < Invidious::Jobs::BaseJob lim_fibers = max_fibers active_fibers = 0 active_channel = Channel(Bool).new - backoff = 1.seconds + backoff = 2.minutes loop do LOGGER.debug("RefreshChannelsJob: Refreshing all channels") @@ -59,8 +59,8 @@ class Invidious::Jobs::RefreshChannelsJob < Invidious::Jobs::BaseJob end # TODO: make this configurable - LOGGER.debug("RefreshChannelsJob: Done, sleeping for one hour") - sleep 1.hour + LOGGER.debug("RefreshChannelsJob: Done, sleeping for thirty minutes") + sleep 30.minutes Fiber.yield end end