added cron job for rss check

This commit is contained in:
ebby 2026-09-25 22:09:28 +02:00
parent 53993111a4
commit 99e7b77bd1
7 changed files with 13 additions and 4 deletions

BIN
backend/cron_state.db Normal file

Binary file not shown.

BIN
backend/cron_state.db-shm Normal file

Binary file not shown.

BIN
backend/cron_state.db-wal Normal file

Binary file not shown.

View file

@ -5,7 +5,7 @@ import feedparser
FEED_URL="https://blauwasser-mausis.de/rss.xml"
def get_feed():
def check_blog_rss_and_send_mail():
feed = feedparser.parse(FEED_URL)
# feed.entries.reverse()

View file

@ -1,14 +1,21 @@
from backend.internal.xml_reader import get_feed
from backend.internal.xml_reader import check_blog_rss_and_send_mail
from .routers import users, comments
from backend.internal.database import create_db_and_tables
from fastapi import APIRouter
from fastapi import FastAPI
from fastapi_crons import Crons, get_cron_router
# TODO: Settings hinzufügen
# TODO: env
# TODO: Deploy
app = FastAPI()
crons = Crons(app)
@crons.cron("0 14 * * *", name="RSS-Check")
async def check_for_new_article():
check_blog_rss_and_send_mail()
@app.on_event("startup")
def on_startup():
@ -19,4 +26,6 @@ router = APIRouter()
app.include_router(users.router)
app.include_router(comments.router)
get_feed()
app.include_router(get_cron_router(), prefix="/crons")