Skip to content

fix(sdk): [NET-1462] StreamrClient#searchStreams() queries using Stream entity #3132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: NET-1464
Choose a base branch
from

Conversation

teogeb
Copy link
Contributor

@teogeb teogeb commented May 23, 2025

This PR is based on #3131, merge that first. This also needs streamr-dev/network-contracts#994 to be deployed to production. The tests in this PR should pass once streamr-docker-dev has been updated to have an up-to-date image of deploy-network-subgraphs-fastchain.

Changed the StreamrClient#searchStreams() to use Stream entity directly. The previous implementation used the StreamPermission entity, which made the queries more complex and slower. See benchmarks below.

This also fixes a potential bug as the previous implementation relied on the contents of StreamPermission#id to be prefixed with stream id. Most or all of the IDs in our subgraphs have used that kind of id format, but it is not a documented feature of the subgraphs.

Benchmarks

The benchmarks were run in dev2 environment which had ~10000 streams

Test Before After Speed reduction
query all streams ~2700ms ~480ms ~80%
search one stream which matches a search term ~44ms ~34ms ~25%
search permissions for user ~72ms ~50ms ~30%
search permissions for user, allowing public permission ~200ms ~100ms ~50%

TODO

  • changelog

Copy link

linear bot commented May 23, 2025

@github-actions github-actions bot added the utils label May 23, 2025
@teogeb teogeb changed the title fix(sdk): StreamrClient#searchStreams() queries using Stream entity fix(sdk): [NET-1462] StreamrClient#searchStreams() queries using Stream entity May 23, 2025
teogeb added a commit to streamr-dev/network-contracts that referenced this pull request May 23, 2025
Added new field to `Stream` entity: `Stream#idAsString`. It has same
value as in the `id` field. The field allows us do to substring queries
for the field id (by using `idAsString_contains` where clause).

This feature is needed e.g. in
streamr-dev/network#3132.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant