Skip to content

Subfetch #75

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.

Activity

  1. changed the title [-]Subfetcher[/-] [+]Subfetch[/+] on Jul 21, 2023
  2. reyamir commented on Jul 24, 2023

    @reyamir

    if we request events by ids, we still need to wait responses from all relays, because we can't sure that events present on certain relay or not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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