opencode-codebase-index 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +14 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -5
- package/dist/index.js.map +1 -1
- package/native/codebase-index-native.win32-x64-msvc.node +0 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3166,10 +3166,14 @@ var Indexer = class {
|
|
|
3166
3166
|
stats.indexedChunks++;
|
|
3167
3167
|
}
|
|
3168
3168
|
}
|
|
3169
|
-
const queue = new PQueue({ concurrency:
|
|
3169
|
+
const queue = new PQueue({ concurrency: 1, interval: 4e3, intervalCap: 1 });
|
|
3170
3170
|
const dynamicBatches = createDynamicBatches(chunksNeedingEmbedding);
|
|
3171
|
+
let rateLimitBackoffMs = 0;
|
|
3171
3172
|
for (const batch of dynamicBatches) {
|
|
3172
3173
|
queue.add(async () => {
|
|
3174
|
+
if (rateLimitBackoffMs > 0) {
|
|
3175
|
+
await new Promise((resolve4) => setTimeout(resolve4, rateLimitBackoffMs));
|
|
3176
|
+
}
|
|
3173
3177
|
try {
|
|
3174
3178
|
const result = await pRetry(
|
|
3175
3179
|
async () => {
|
|
@@ -3178,15 +3182,17 @@ var Indexer = class {
|
|
|
3178
3182
|
},
|
|
3179
3183
|
{
|
|
3180
3184
|
retries: this.config.indexing.retries,
|
|
3181
|
-
minTimeout: this.config.indexing.retryDelayMs,
|
|
3182
|
-
|
|
3185
|
+
minTimeout: Math.max(this.config.indexing.retryDelayMs, 5e3),
|
|
3186
|
+
// Minimum 5s between retries
|
|
3187
|
+
maxTimeout: 6e4,
|
|
3188
|
+
// Max 60s backoff
|
|
3183
3189
|
factor: 2,
|
|
3184
3190
|
onFailedAttempt: (error) => {
|
|
3185
3191
|
const message = getErrorMessage(error);
|
|
3186
3192
|
if (isRateLimitError(error)) {
|
|
3187
|
-
|
|
3193
|
+
rateLimitBackoffMs = Math.min(6e4, (rateLimitBackoffMs || 5e3) * 2);
|
|
3188
3194
|
console.error(
|
|
3189
|
-
`Rate limited (attempt ${error.attemptNumber}/${error.retriesLeft + error.attemptNumber}): waiting before retry...`
|
|
3195
|
+
`Rate limited (attempt ${error.attemptNumber}/${error.retriesLeft + error.attemptNumber}): waiting ${rateLimitBackoffMs / 1e3}s before retry...`
|
|
3190
3196
|
);
|
|
3191
3197
|
} else {
|
|
3192
3198
|
console.error(
|
|
@@ -3196,6 +3202,9 @@ var Indexer = class {
|
|
|
3196
3202
|
}
|
|
3197
3203
|
}
|
|
3198
3204
|
);
|
|
3205
|
+
if (rateLimitBackoffMs > 0) {
|
|
3206
|
+
rateLimitBackoffMs = Math.max(0, rateLimitBackoffMs - 2e3);
|
|
3207
|
+
}
|
|
3199
3208
|
const items = batch.map((chunk, idx) => ({
|
|
3200
3209
|
id: chunk.id,
|
|
3201
3210
|
vector: result.embeddings[idx],
|