-
Notifications
You must be signed in to change notification settings - Fork 57
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
feat: example using filter and lightpush #1720
Conversation
1695e4c
to
928e32e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does look great! Thanks for this PR!
asyncSpawn maintainSubscription(wfc, filterPeer, FilterPubsubTopic, FilterContentTopic) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for my understanding, in which cases we should use asyncSpawn
? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this is to dispatch a future without awaiting its result. However, if you simply discard the future it may contain errors which gets "swallowed". For that reason, you should always use asyncSpawn
, which will convert any error in the future to a Defect
. See https://github.com/status-im/nim-chronos/blob/8563c936733a28bc1e773542e9741b5b55dfcaeb/chronos/asyncloop.nim#L130-L137
Co-authored-by: Ivan Folgueira Bande <128452529+Ivansete-status@users.noreply.github.com>
Co-authored-by: Ivan Folgueira Bande <128452529+Ivansete-status@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great example! super useful!
While working on testing the new filter protocol, I realised that it will have some value to package a lightpush publisher and filter subscriber as an example.
I've tried to keep to the spirit of the current subscriber-publisher example, but without adding to our current MAKE targets.