Open natew opened 6 years ago
This has to do with the 'streaming' nature of Gun. You could filter out redundant messages in your callback or use a module like 'open()' https://gun.eco/docs/API#-a-name-open-a-gun-open-callback- or synclist() https://www.npmjs.com/package/gun-synclist
@Stefdv thanks for those mentions, although I think the 1st link got messed up, here it is: https://gun.eco/docs/API#open
@natew yeah, another easy fix is to do .map().once(cb)
which will only grab each item once.
Ideally, I want to get the duplicate events fixed, but because .on(cb)
subscribes, and the same data may come from multiple adapters (memory, disk, S3, IPFS, etc.) and from other peers. (And even if you don't have any other adapters/peers, on
is sometimes "chatty") this technically isn't wrong behavior, but yes it should be improved at some point in the future.
Running the following on node 9:
Logs a ton of stuff: