mirror of
https://github.com/nethunterzist/trendyol-analiz
synced 2026-08-29 21:38:00 +00:00
fix(scrape): 0 ürünlü rapor FAILED olarak işaretleniyor
All checks were successful
ciromarket-backend-build-and-deploy / build (push) Successful in 2m8s
All checks were successful
ciromarket-backend-build-and-deploy / build (push) Successful in 2m8s
Ne yaptık: - SSE endpoint: tüm subcategory'ler başarısız olursa type=failed event yield et, DB'ye kaydetme - queue_worker: total_products==0 ve en az 1 kategori denendiyse _mark_failed() çağır Neden yaptık: - Trendyol rate limit (HTTP 556) durumunda tüm subcategory'ler success=False dönüyor - Sistem bunu hata olarak değil "0 ürünlü başarılı rapor" olarak kaydediyordu - Kullanıcıya "Bu kategoride ürün bulunamadı / Farklı kategori deneyin" mesajı çıkıyordu — tamamen yanıltıcı - Artık FAILED → Spring Boot CiromarketSseConsumer/QueuePoller → SellerX DB FAILED → frontend hata mesajı
This commit is contained in:
@@ -329,6 +329,12 @@ class QueueWorker:
|
||||
except Exception as e:
|
||||
log.warning(f"Enrichment failed (non-critical): {e}")
|
||||
|
||||
# Tüm subcategory'ler başarısız olduysa FAILED işaretle
|
||||
if results.get("total_products", 0) == 0 and len(results.get("details", [])) > 0:
|
||||
self._mark_failed(db, queue_id, "Trendyol geçici olarak kullanılamıyor. Lütfen birkaç dakika bekleyip tekrar deneyin.")
|
||||
log.warning(f"Task {queue_id} scrape_failed: 0 products from {len(results['details'])} categories")
|
||||
return
|
||||
|
||||
# Mark COMPLETED
|
||||
self._mark_completed(db, queue_id, report_id)
|
||||
log.info(f"Task {queue_id} completed: report_id={report_id}, products={results['total_products']}")
|
||||
|
||||
Reference in New Issue
Block a user