changed method of fetching crontab schedule
This commit is contained in:
+9
-3
@@ -17,7 +17,7 @@ from fastapi.responses import PlainTextResponse
|
||||
from calendar_feed import build_ics
|
||||
from datasource import EventStore, iter_artist_names, parse_event_date
|
||||
from models import Event, EventList
|
||||
from scrape_schedule import get_schedule_info
|
||||
from scrape_schedule import discover_cron_expr, get_schedule_info
|
||||
|
||||
app = FastAPI(
|
||||
title="Fundi Scraper API",
|
||||
@@ -59,8 +59,14 @@ def _matches(
|
||||
|
||||
@app.get("/health")
|
||||
def health():
|
||||
scrape_cron = os.environ.get("SCRAPE_CRON")
|
||||
archive_scrape_cron = os.environ.get("ARCHIVE_SCRAPE_CRON") or scrape_cron
|
||||
scrape_cron = os.environ.get("SCRAPE_CRON") or discover_cron_expr(
|
||||
"scraper.py", archive=False
|
||||
)
|
||||
archive_scrape_cron = (
|
||||
os.environ.get("ARCHIVE_SCRAPE_CRON")
|
||||
or discover_cron_expr("scraper.py", archive=True)
|
||||
or scrape_cron
|
||||
)
|
||||
return {
|
||||
"status": "ok",
|
||||
"events_loaded": len(store.all()),
|
||||
|
||||
Reference in New Issue
Block a user