Skip to content
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

config: add maxReqFilterSize #133

Merged
merged 2 commits into from
Dec 20, 2024
Merged

config: add maxReqFilterSize #133

merged 2 commits into from
Dec 20, 2024

Conversation

jb55
Copy link
Contributor

@jb55 jb55 commented Dec 20, 2024

Add a configurable option for expanding the number of allowed filters in REQ.

The motivation here is to support queries of this nature:

["REQ", "last-note-from-each-user",
{ "authors": [ "a" ], "kinds": [ 1 ], "limit": 1 },
{ "authors": [ "b" ], "kinds": [ 1 ], "limit": 1 },
{ "authors": [ "c" ], "kinds": [ 1 ], "limit": 1 },
{ "authors": [ "d" ], "kinds": [ 1 ], "limit": 1 },
{ "authors": [ "e" ], "kinds": [ 1 ], "limit": 1 },
{ "authors": [ "f" ], "kinds": [ 1 ], "limit": 1 },
{ "authors": [ "g" ], "kinds": [ 1 ], "limit": 1 },
{ "authors": [ "h" ], "kinds": [ 1 ], "limit": 1 },
{ "authors": [ "i" ], "kinds": [ 1 ], "limit": 1 }
...
* 1000
]

jb55 added 2 commits December 20, 2024 10:11
newer nixpkgs have flatbuffers set to v24 which doesn't work
Add a configurable option for expanding the number of allowed filters
in REQ.

The motivation here is to support queries of this nature:

["REQ", "last-note-from-each-user",
{ "authors": [ "a" ], "kinds": [ 1 ], "limit": 1 },
{ "authors": [ "b" ], "kinds": [ 1 ], "limit": 1 },
{ "authors": [ "c" ], "kinds": [ 1 ], "limit": 1 },
{ "authors": [ "d" ], "kinds": [ 1 ], "limit": 1 },
{ "authors": [ "e" ], "kinds": [ 1 ], "limit": 1 },
{ "authors": [ "f" ], "kinds": [ 1 ], "limit": 1 },
{ "authors": [ "g" ], "kinds": [ 1 ], "limit": 1 },
{ "authors": [ "h" ], "kinds": [ 1 ], "limit": 1 },
{ "authors": [ "i" ], "kinds": [ 1 ], "limit": 1 }
...
* 1000
]
@vitorpamplona
Copy link

YES!!!

@jb55
Copy link
Contributor Author

jb55 commented Dec 20, 2024

Lol vitor i knew you would like this one. Please don't DoS me.

Copy link
Owner

@hoytech hoytech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I believe this param can be hot reloaded safely. I will test that and if so remove the noReload. Maybe we should up the default too?

@hoytech hoytech merged commit 2fb8551 into hoytech:master Dec 20, 2024
1 check passed
@jb55
Copy link
Contributor Author

jb55 commented Dec 20, 2024

yeah 20 seems a bit small, especially if we want to do these kinds of queries, up to you!

@vitorpamplona
Copy link

20 -> 1000 :)

jb55 added a commit to damus-io/notedeck that referenced this pull request Dec 27, 2024
This function creates filters for the base our first algo in Damus:

Called "last N note per pubkey". I don't have a better name for it.

This function generates a query in the form:

[
  {"authors": ["author_a"], "limit": 1, "kinds": [1]
, {"authors": ["author_b"], "limit": 1, "kinds": [1]
, {"authors": ["author_c"], "limit": 1, "kinds": [1]
, {"authors": ["author_c"], "limit": 1, "kinds": [1]
  ...
]

Due to an unfortunate restriction currently in nostrdb and strfry, we
can only do about 16 to 20 of these at any given time. I have made
this limit configurable in strfry[1]. I just need to do the same in
nostrdb now.

[1] hoytech/strfry#133

Changelog-Added: Add last_n_per_pubkey_from_tags algo function
jb55 added a commit to damus-io/notedeck that referenced this pull request Jan 14, 2025
This function creates filters for the base our first algo in Damus:

Called "last N note per pubkey". I don't have a better name for it.

This function generates a query in the form:

[
  {"authors": ["author_a"], "limit": 1, "kinds": [1]
, {"authors": ["author_b"], "limit": 1, "kinds": [1]
, {"authors": ["author_c"], "limit": 1, "kinds": [1]
, {"authors": ["author_c"], "limit": 1, "kinds": [1]
  ...
]

Due to an unfortunate restriction currently in nostrdb and strfry, we
can only do about 16 to 20 of these at any given time. I have made
this limit configurable in strfry[1]. I just need to do the same in
nostrdb now.

[1] hoytech/strfry#133

Changelog-Added: Add last_n_per_pubkey_from_tags algo function
jb55 added a commit to damus-io/notedeck that referenced this pull request Jan 20, 2025
This function creates filters for the base our first algo in Damus:

Called "last N note per pubkey". I don't have a better name for it.

This function generates a query in the form:

[
  {"authors": ["author_a"], "limit": 1, "kinds": [1]
, {"authors": ["author_b"], "limit": 1, "kinds": [1]
, {"authors": ["author_c"], "limit": 1, "kinds": [1]
, {"authors": ["author_c"], "limit": 1, "kinds": [1]
  ...
]

Due to an unfortunate restriction currently in nostrdb and strfry, we
can only do about 16 to 20 of these at any given time. I have made
this limit configurable in strfry[1]. I just need to do the same in
nostrdb now.

[1] hoytech/strfry#133

Changelog-Added: Add last_n_per_pubkey_from_tags algo function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants