Change default limit for router urls

This commit is contained in:
Jon Staab
2024-12-11 11:02:33 -08:00
parent 6f75ef4ab9
commit ab0517e804
2 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -260,7 +260,7 @@ export class RouterScenario {
getPolicy = () => this.options.policy || addMaximalFallbacks getPolicy = () => this.options.policy || addMaximalFallbacks
getLimit = () => this.options.limit || this.router.options.getLimit?.() || 10 getLimit = () => this.options.limit || this.router.options.getLimit?.() || 3
getUrls = () => { getUrls = () => {
const limit = this.getLimit() const limit = this.getLimit()
@@ -366,7 +366,7 @@ export const makeRouter = (options: Partial<RouterOptions> = {}) =>
getSearchRelays, getSearchRelays,
getRelayQuality, getRelayQuality,
getUserPubkey: () => pubkey.get(), getUserPubkey: () => pubkey.get(),
getLimit: () => 5, getLimit: () => 3,
...options, ...options,
}) })
+4 -4
View File
@@ -137,8 +137,8 @@ export const storageAdapters = {
keyPath: "key", keyPath: "key",
store: adapter({ store: adapter({
store: throttled(options.throttle || 0, store), store: throttled(options.throttle || 0, store),
forward: ($data: Record<string, T>) => forward: (data: Record<string, T>) =>
migrate(Object.entries($data).map(([key, value]) => ({key, value})), options), migrate(Object.entries(data).map(([key, value]) => ({key, value})), options),
backward: (data: {key: string, value: T}[]) => backward: (data: {key: string, value: T}[]) =>
fromPairs(data.map(({key, value}) => [key, value])), fromPairs(data.map(({key, value}) => [key, value])),
}), }),
@@ -148,8 +148,8 @@ export const storageAdapters = {
keyPath: "key", keyPath: "key",
store: adapter({ store: adapter({
store: throttled(options.throttle || 0, store), store: throttled(options.throttle || 0, store),
forward: ($data: Map<string, T>) => forward: (data: Map<string, T>) =>
migrate(Array.from($data.entries()).map(([key, value]) => ({key, value})), options), migrate(Array.from(data.entries()).map(([key, value]) => ({key, value})), options),
backward: (data: {key: string, value: T}[]) => backward: (data: {key: string, value: T}[]) =>
new Map(data.map(({key, value}) => [key, value])), new Map(data.map(({key, value}) => [key, value])),
}), }),