Use user relays for basic scenarios
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "paravel",
|
"name": "paravel",
|
||||||
"version": "0.5.5",
|
"version": "0.5.6",
|
||||||
"description": "Yet another toolkit for nostr",
|
"description": "Yet another toolkit for nostr",
|
||||||
"author": "hodlbod",
|
"author": "hodlbod",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|||||||
+4
-4
@@ -85,11 +85,11 @@ export class Router {
|
|||||||
|
|
||||||
// Routing scenarios
|
// 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()])
|
AllMessages = () => this.scenario([this.getUserRelays()])
|
||||||
|
|
||||||
@@ -257,7 +257,7 @@ export class RouterScenario {
|
|||||||
const fallbackPolicy = this.getPolicy()
|
const fallbackPolicy = this.getPolicy()
|
||||||
const urls = this.router.scoreGroups(this.groups).map(s => s.url)
|
const urls = this.router.scoreGroups(this.groups).map(s => s.url)
|
||||||
const limit = this.getLimit()
|
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()) {
|
for (const url of this.getFallbackRelays()) {
|
||||||
if (urls.length >= limitWithFallbacks) {
|
if (urls.length >= limitWithFallbacks) {
|
||||||
|
|||||||
Reference in New Issue
Block a user