Skip to content

Subfetch #75

@jiftechnify

Description

@jiftechnify

Currently, it is inefficient to fetch events related to the events that are fetched in a streaming manner (via allEventsIterator etc.) using nostr-fetch because we must wait until all events are fetched and then query related events and we can't run these fetches concurrently.

Introducing the concept of "subfetch" may resolve this issue.

API sketch:
NostrFetcher.subfetch<T>(stream: AsyncIterable<T>, deriveFilters: (v: T) => Filter[]): AsyncIterable<NostrEvent>

where:

  • stream is stream of things, usually NostrEvent but we have no reason to limit the type of items.
  • deriveFilters is a function that derives Filters from each item from the stream.

Considerations:

  • How to batch and merge filters?
  • If we request events by ids, we don't have to wait responses from all relays.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions