Repos / pytaku / f4c47aab2b
commit f4c47aab2ba2b08ccdc07b1c3694ef53277f4480
Author: Bùi Thành Nhân <hi@imnhan.com>
Date: Sat Jun 19 17:44:59 2021 +0700
updating every 12hrs is more than enough
diff --git a/src/pytaku/persistence.py b/src/pytaku/persistence.py
index 0144cbf..17ca544 100644
--- a/src/pytaku/persistence.py
+++ b/src/pytaku/persistence.py
@@ -302,7 +302,7 @@ def unread(user_id, site, title_id, chapter_id):
)
-def find_outdated_titles(since="-6 hours"):
+def find_outdated_titles(since="-12 hours"):
return run_sql(
"SELECT id, site FROM title WHERE updated_at <= datetime('now', ?);", (since,)
)
diff --git a/src/pytaku/scheduler.py b/src/pytaku/scheduler.py
index 389228e..07255b8 100644
--- a/src/pytaku/scheduler.py
+++ b/src/pytaku/scheduler.py
@@ -1,4 +1,3 @@
-import random
import time
import traceback
from abc import ABC, abstractmethod
@@ -65,7 +64,9 @@ class UpdateOutdatedTitles(Worker):
interval = timedelta(hours=2)
def run(self):
- for title in find_outdated_titles():
+ outdated_titles = find_outdated_titles()
+ print(f"Found {len(outdated_titles)} outdated titles")
+ for title in outdated_titles:
if title["site"] == "mangadex":
# print(f"Skipped title {title['id']} from {title['site']}.")
continue