fix: 429 retry, sequential batching, force UI refresh after prescreen

1. prescreener.py: classify_with_deepseek now retries on 429 with
   exponential back-off (5s → 10s → 20s → 40s, up to 4 attempts);
   same back-off also covers other transient errors.

2. main.py: prescreen batches run sequentially with a 3s gap instead
   of asyncio.gather (parallel). Parallel batches caused the second
   batch to always hit the 429 rate limit, leaving most domains
   unclassified (only the smaller last batch succeeded).

3. index.html: prescreenSelected() now clears this.domains before
   calling _fetch() so Alpine re-renders the full table with the
   updated niche/type values; also updates the notify hint to mention
   the expected 1-2 min wait.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-17 21:52:39 +02:00
parent a30085975e
commit 468d76387d
3 changed files with 76 additions and 57 deletions

View File

@@ -773,7 +773,8 @@ function app() {
async prescreenSelected() {
if(!this.selected.length || this.prescreening) return;
this.prescreening = true;
this.notify(`Pre-screening ${this.selected.length} domains… (may take ~30s)`, 'info');
const count = this.selected.length;
this.notify(`Pre-screening ${count} domains… (DeepSeek classification may take 1-2 min)`, 'info');
try {
const r = await fetch('/api/prescreen/batch', {
method: 'POST',
@@ -786,7 +787,10 @@ function app() {
`${d.live} live · 🅿 ${d.parked} parked · ↗ ${d.redirect} redirect · ☠ ${d.dead} dead · 🏷 ${d.classified} classified`,
'success'
);
await this._fetch(); // refresh to show niche/type columns
this.selected = [];
// Force full re-fetch of current page to show updated niche/type
this.domains = [];
await this._fetch();
} else {
this.notify('Error: ' + (d.error||'unknown'), 'error');
}