summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsaltycrys <73420320+saltycrys@users.noreply.github.com>2021-01-23 19:41:50 +0100
committersaltycrys <73420320+saltycrys@users.noreply.github.com>2021-01-23 19:45:42 +0100
commit70e14f92a46dd15bf118d41fd6ab5bcd2c3ee807 (patch)
tree770d2321760da00da2a823405ea09ddbca457ed5
parentb45f371911502d6687fc0402139af5268ee5b13f (diff)
downloadinvidious-70e14f92a46dd15bf118d41fd6ab5bcd2c3ee807.tar.gz
invidious-70e14f92a46dd15bf118d41fd6ab5bcd2c3ee807.tar.bz2
invidious-70e14f92a46dd15bf118d41fd6ab5bcd2c3ee807.zip
Only start refresh jobs when necessary
If `channel_threads` or `feed_threads` is set to zero the corresponding job is now not started.
-rw-r--r--src/invidious.cr9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/invidious.cr b/src/invidious.cr
index 66a88f56..983e6196 100644
--- a/src/invidious.cr
+++ b/src/invidious.cr
@@ -162,8 +162,13 @@ end
# Start jobs
-Invidious::Jobs.register Invidious::Jobs::RefreshChannelsJob.new(PG_DB)
-Invidious::Jobs.register Invidious::Jobs::RefreshFeedsJob.new(PG_DB)
+if CONFIG.channel_threads > 0
+ Invidious::Jobs.register Invidious::Jobs::RefreshChannelsJob.new(PG_DB)
+end
+
+if CONFIG.feed_threads > 0
+ Invidious::Jobs.register Invidious::Jobs::RefreshFeedsJob.new(PG_DB)
+end
DECRYPT_FUNCTION = DecryptFunction.new(CONFIG.decrypt_polling)
if CONFIG.decrypt_polling