subscribe-with-prefix #75

Merged
offbyn merged 1 commits from subscribe-with-prefix into master 10 months ago
Owner

fixes #69

fixes #69
offbyn added 2 commits 10 months ago
ci/woodpecker/push/woodpecker Pipeline was successful Details
ci/woodpecker/pr/woodpecker Pipeline was successful Details
cce0bd9115
feed: subscribe to pow events
if difficulty-filter is set the subscription of the global feed
can filter only ids with 0-prefix to save bandwidth.

as there may not be many pow events within the last 24h, the
date range is now only enabled if there is no diffculty-filter
set so that the feed is not empty.

if this works as expected it could also only subscripe to
reactions and profile info with pow ids.
offbyn force-pushed subscribe-with-prefix from cce0bd9115 to b4bb503bdd 10 months ago
offbyn requested review from x1ddos 10 months ago
x1ddos reviewed 10 months ago
x1ddos left a comment
Owner

if this works as expected it could also only subscripe to reactions and profile info with pow ids.

do it now in this PR? so it's all in a single change.

also, don't you want to apply the same filter for future events? here:

// subscribe to future notes, reactions and profile updates
sub({ ...
> if this works as expected it could also only subscripe to reactions and profile info with pow ids. do it now in this PR? so it's all in a single change. also, don't you want to apply the same filter for future events? here: ```js // subscribe to future notes, reactions and profile updates sub({ ... ```
@ -13,6 +14,7 @@ export const sub24hFeed = (onEvent: SubCallback) => {
const now = Math.floor(Date.now() * 0.001);
const pubkeys = new Set<string>();
const notes = new Set<string>();
const prefix = Math.floor(config.filterDifficulty * 0.25);
Owner

consider using division instead of multiplying. i find this easier to understand:

const prefix = Math.floor(config.filterDifficulty / 4);

because there are 4 bits in each '0' character.

consider using division instead of multiplying. i find this easier to understand: ```js const prefix = Math.floor(config.filterDifficulty / 4); ``` because there are 4 bits in each `'0'` character.
Poster
Owner

makes sense

makes sense
Owner

fixes #75

#75 is this PR :)
maybe you meant #69?

> fixes #75 #75 is this PR :) maybe you meant https://git.qcode.ch/nostr/nostrweb/issues/69?
offbyn force-pushed subscribe-with-prefix from b4bb503bdd to e83e083e3d 10 months ago
offbyn force-pushed subscribe-with-prefix from e83e083e3d to 5734736458 10 months ago
offbyn force-pushed subscribe-with-prefix from 5734736458 to 4a8025cfe9 10 months ago
offbyn force-pushed subscribe-with-prefix from 4a8025cfe9 to 5e61dcef0c 10 months ago
offbyn merged commit 5e61dcef0c into master 10 months ago
offbyn deleted branch subscribe-with-prefix 10 months ago
x1ddos approved these changes 10 months ago

Reviewers

x1ddos approved these changes 10 months ago
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/push/woodpecker Pipeline was successful
The pull request has been merged as 5e61dcef0c.
You can also view command line instructions.

Step 1:

From your project repository, check out a new branch and test the changes.
git checkout -b subscribe-with-prefix master
git pull origin subscribe-with-prefix

Step 2:

Merge the changes and update on Gitea.
git checkout master
git merge --no-ff subscribe-with-prefix
git push origin master
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: nostr/nostrweb#75
Loading…
There is no content yet.