Changeset 0.28.8 (#194)
This commit is contained in:
@@ -15,6 +15,25 @@
|
||||
};
|
||||
T.PROVIDER_DEFAULTS = PROVIDER_DEFAULTS;
|
||||
|
||||
// ─── Retry Helper (upstream timeout resilience) ────────────
|
||||
|
||||
// apiPostRetry retries a POST once on 502/504. Slow upstream providers
|
||||
// (especially Venice) can exceed the reverse proxy timeout on cold starts.
|
||||
// A single retry with a short backoff is enough to ride out transient timeouts.
|
||||
async function apiPostRetry(path, body, retries) {
|
||||
if (retries === undefined) retries = 1;
|
||||
try {
|
||||
return await T.apiPost(path, body);
|
||||
} catch (e) {
|
||||
if (retries > 0 && (e.status === 502 || e.status === 504)) {
|
||||
console.log(' ⟳ got ' + e.status + ' from ' + path + ', retrying in 2s…');
|
||||
await new Promise(function (r) { setTimeout(r, 2000); });
|
||||
return await apiPostRetry(path, body, retries - 1);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
// ─── SSE Completion Helper ──────────────────────────────────
|
||||
|
||||
T.testCompletion = async function (channelId, model, providerConfigId, label) {
|
||||
@@ -164,7 +183,7 @@
|
||||
});
|
||||
|
||||
await T.test('provider', 'global', 'POST /admin/models/fetch (sync catalog)', async function () {
|
||||
var d = await T.apiPost('/admin/models/fetch', { provider_config_id: globalConfigId });
|
||||
var d = await apiPostRetry('/admin/models/fetch', { provider_config_id: globalConfigId });
|
||||
T.assert(typeof d === 'object', 'expected object');
|
||||
T.assert(d.total !== undefined || d.added !== undefined || d.message,
|
||||
'expected sync result, got keys: ' + Object.keys(d).join(', '));
|
||||
@@ -387,7 +406,7 @@
|
||||
});
|
||||
|
||||
await T.test('provider', 'byok', 'POST /api-configs/:id/models/fetch (sync)', async function () {
|
||||
var d = await T.apiPost('/api-configs/' + byokConfigId + '/models/fetch', {});
|
||||
var d = await apiPostRetry('/api-configs/' + byokConfigId + '/models/fetch', {});
|
||||
T.assert(typeof d === 'object', 'expected object');
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user