mslxdff 0.1.13 → 0.1.14
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/package.json +1 -1
- package/src/routes.js +8 -7
package/package.json
CHANGED
package/src/routes.js
CHANGED
|
@@ -240,14 +240,15 @@ const ROUTES = [
|
|
|
240
240
|
}
|
|
241
241
|
|
|
242
242
|
// local failed for this model: try peers ordered hot-first (reuse
|
|
243
|
-
// their last successful model without probing
|
|
244
|
-
// health probe before the forward
|
|
243
|
+
// their last successful model without probing when it matches the
|
|
244
|
+
// requested model), cold peers get a health probe before the forward
|
|
245
245
|
if (canForwardPeers) {
|
|
246
246
|
for (const peer of peers.ordered()) {
|
|
247
247
|
let target = null;
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
|
|
248
|
+
const prevModel = peers.stat(peer.url)?.model;
|
|
249
|
+
const hot = peers.isHot(peer.url) && prevModel === model;
|
|
250
|
+
if (hot) {
|
|
251
|
+
target = prevModel;
|
|
251
252
|
} else {
|
|
252
253
|
const healthy = await peerHealthyModels(peer);
|
|
253
254
|
if (!healthy.length) {
|
|
@@ -258,7 +259,7 @@ const ROUTES = [
|
|
|
258
259
|
continue;
|
|
259
260
|
}
|
|
260
261
|
evt("peer-health", { peer: peer.url, healthy, count: healthy.length });
|
|
261
|
-
target = healthy[0];
|
|
262
|
+
target = healthy.includes(model) ? model : healthy[0];
|
|
262
263
|
}
|
|
263
264
|
|
|
264
265
|
const t0 = performance.now();
|
|
@@ -270,7 +271,7 @@ const ROUTES = [
|
|
|
270
271
|
if (hot) {
|
|
271
272
|
const healthy = await peerHealthyModels(peer);
|
|
272
273
|
if (healthy.length) {
|
|
273
|
-
target = healthy[0];
|
|
274
|
+
target = healthy.includes(model) ? model : healthy[0];
|
|
274
275
|
const t1 = performance.now();
|
|
275
276
|
peerRes = await forwardToPeer(peer, body, target, hops);
|
|
276
277
|
latencyMs = Math.round(performance.now() - t1);
|