Files
iaai-parser/_rollback_limits.sh

25 lines
1.2 KiB
Bash

#!/bin/bash
set -e
cd /root/iaai_scraper_project
echo "== 1. Verify .env =="
grep -E "MAX_PAGES|MAX_VEHICLES" .env
echo ""
echo "== 2. Restart worker + beat (не трогаем redis/postgres) =="
docker compose restart worker beat
sleep 5
echo ""
echo "== 3. Clear Redis lock =="
docker exec iaai-redis redis-cli del iaai:locks:sync_listing iaai:state:startup_sync_dispatched iaai:state:sync_listing_followup_pending
echo ""
echo "== 4. Dispatch fresh task =="
docker exec iaai-worker python -c "from iaai_scraper.worker.celery_app import celery_app; r=celery_app.send_task('iaai_scraper.worker.tasks.sync_listing_task', kwargs={'only_new': False}, queue='scraping'); print('dispatched:', r.id)"
echo ""
echo "== 5. Wait 45s, then check =="
sleep 45
echo ""
echo "== LOGS =="
docker logs iaai-worker --tail 250 2>&1 | grep -E "Segment|HTTP-mode page [0-9]+0:|HTTP-mode batch|HTTP-mode listing done|Sync run.*finished|upserted=" | tail -25
echo ""
echo "== DB =="
docker exec iaai-postgres psql -U iaai -d iaai_scraper -t -c "select 'total=' || count(*), 'last_2min=' || count(*) filter (where last_seen_at > now() - interval '2 minutes'), 'max=' || max(last_seen_at)::text from cars;"