fix scheduler with separate script
This commit is contained in:
@@ -21,26 +21,7 @@ services:
|
||||
- ./.env:/app/.env:ro
|
||||
environment:
|
||||
- TZ=Europe/Vienna
|
||||
command: >
|
||||
python -c "
|
||||
import schedule
|
||||
import time
|
||||
from src.main import FlatScraper
|
||||
|
||||
def run_scraper():
|
||||
scraper = FlatScraper()
|
||||
scraper.run_once()
|
||||
|
||||
# Schedule every 6 hours
|
||||
schedule.every(6).hours.do(run_scraper)
|
||||
|
||||
print('Scheduler started. Running every 6 hours.')
|
||||
run_scraper() # Run immediately
|
||||
|
||||
while True:
|
||||
schedule.run_pending()
|
||||
time.sleep(60)
|
||||
"
|
||||
command: python scheduler.py
|
||||
# platform: linux/arm64
|
||||
depends_on:
|
||||
- flat-scraper
|
||||
|
||||
Reference in New Issue
Block a user