~nhanb/pytaku

f4c47aab2ba2b08ccdc07b1c3694ef53277f4480 — Bùi Thành Nhân a month ago baaf53e
updating every 12hrs is more than enough
2 files changed, 4 insertions(+), 3 deletions(-)

M src/pytaku/persistence.py
M src/pytaku/scheduler.py
M src/pytaku/persistence.py => src/pytaku/persistence.py +1 -1
@@ 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,)
    )

M src/pytaku/scheduler.py => src/pytaku/scheduler.py +3 -2
@@ 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