From 86870e6fd70d7440fa6444a84c496a944784c1dd Mon Sep 17 00:00:00 2001 From: Jon Staab Date: Thu, 21 Mar 2024 10:11:59 -0700 Subject: [PATCH] Use user relays for basic scenarios --- package.json | 2 +- src/util/Router.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 81cf69d..cf1b797 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "paravel", - "version": "0.5.5", + "version": "0.5.6", "description": "Yet another toolkit for nostr", "author": "hodlbod", "license": "MIT", diff --git a/src/util/Router.ts b/src/util/Router.ts index 78dceb6..d76699a 100644 --- a/src/util/Router.ts +++ b/src/util/Router.ts @@ -85,11 +85,11 @@ export class Router { // Routing scenarios - User = () => this.scenario([]) + User = () => this.scenario([this.getUserRelays()]) - ReadRelays = () => this.scenario([]).mode(RelayMode.Read) + ReadRelays = () => this.scenario([this.getUserRelays()]).mode(RelayMode.Read) - WriteRelays = () => this.scenario([]).mode(RelayMode.Write) + WriteRelays = () => this.scenario([this.getUserRelays()]).mode(RelayMode.Write) AllMessages = () => this.scenario([this.getUserRelays()]) @@ -257,7 +257,7 @@ export class RouterScenario { const fallbackPolicy = this.getPolicy() const urls = this.router.scoreGroups(this.groups).map(s => s.url) const limit = this.getLimit() - const limitWithFallbacks = limit + fallbackPolicy(urls, limit) + const limitWithFallbacks = Math.min(limit, urls.length) + fallbackPolicy(urls, limit) for (const url of this.getFallbackRelays()) { if (urls.length >= limitWithFallbacks) {