Use user relays for basic scenarios

This commit is contained in:
Jon Staab
2024-03-21 10:11:59 -07:00
parent c6c8806b0c
commit 86870e6fd7
2 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "paravel",
"version": "0.5.5",
"version": "0.5.6",
"description": "Yet another toolkit for nostr",
"author": "hodlbod",
"license": "MIT",
+4 -4
View File
@@ -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) {