Commit 613698a4f9211cb8b1e75978401b1edf3831c673
Do not include 'sync' messages in the backlinks filter obs list.
Gordon Martin committed on 11/26/2017, 9:31:05 PMParent: b70e39416e0ec7a808742b9841a6cd32d45b3354
Files changed
backlinks/obs_filter.js | changed |
backlinks/obs_filter.js | |||
---|---|---|---|
@@ -44,14 +44,22 @@ | |||
44 | 44 … | }], | |
45 | 45 … | live: true | |
46 | 46 … | }) | |
47 | 47 … | ||
48 … | + var msgFilter = pull.filter((msg) => { | ||
49 … | + // We do not include the 'sync' message which indicates that any | ||
50 … | + // further messages are newly gossiped messages in the list of messages. | ||
51 … | + if (msg.sync) { | ||
52 … | + sync.set(true) | ||
53 … | + return false | ||
54 … | + } else { | ||
55 … | + return filterFn(msg) | ||
56 … | + } | ||
57 … | + }) | ||
58 … | + | ||
48 | 59 … | var filteredBacklinks = pull( | |
49 | 60 … | msgBacklinks, | |
50 | - pull( | ||
51 | - pull.map(setSyncIfSyncMsg.bind(null, sync), | ||
52 | - pull.filter(filterFn) | ||
53 | - )) | ||
61 … | + msgFilter | ||
54 | 62 … | ) | |
55 | 63 … | ||
56 | 64 … | var backlinksObs = MutantPullReduce(filteredBacklinks, (state, msg) => { | |
57 | 65 … | state.push(msg) | |
@@ -69,12 +77,4 @@ | |||
69 | 77 … | return nest({ | |
70 | 78 … | "backlinks.filter.obs": (id, filterFn) => pullFilterReduceObs(id, filterFn) | |
71 | 79 … | }) | |
72 | 80 … | } | |
73 | - | ||
74 | -function setSyncIfSyncMsg(syncObs, msg) { | ||
75 | - if (msg.sync) { | ||
76 | - syncObs.set(true) | ||
77 | - } | ||
78 | - | ||
79 | - return msg | ||
80 | -} |
Built with git-ssb-web