Switch to sequential batching to eliminate rate limit hits
1 concurrent + 20s pacing = ~3 batches/min × 2k tokens = 6k TPM, safely under the 8k output TPM limit. Progress estimate updated to 22s/batch. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -22,7 +22,7 @@ public class AiCatalogPriceCheckService : IAiCatalogPriceCheckService
|
||||
|
||||
private const string Model = "claude-haiku-4-5-20251001";
|
||||
private const int BatchSize = 25;
|
||||
private const int MaxConcurrentBatches = 2;
|
||||
private const int MaxConcurrentBatches = 1; // sequential avoids bursting past the 8k output TPM limit
|
||||
private const int RateLimitRetrySeconds = 65;
|
||||
private const int MinBatchIntervalSeconds = 20; // proactive pacing: ~3 batches/min × ~2k tokens = ~6k TPM, under the 8k limit
|
||||
|
||||
|
||||
@@ -11,11 +11,10 @@
|
||||
if (!form || !btn || !overlay) return;
|
||||
|
||||
// Estimate total seconds based on item count.
|
||||
// Haiku: 2 concurrent batches, ~25s per wave (includes occasional rate-limit waits).
|
||||
// Haiku sequential: 1 batch at a time, ~22s each (API time + 20s pacing gap).
|
||||
function estimateDuration(itemCount) {
|
||||
var batches = Math.max(1, Math.ceil(itemCount / 25));
|
||||
var waves = Math.ceil(batches / 2);
|
||||
return Math.max(30, waves * 25);
|
||||
return Math.max(30, batches * 22);
|
||||
}
|
||||
|
||||
// Messages keyed to approximate progress milestones (0–100).
|
||||
|
||||
Reference in New Issue
Block a user