git ssb

7+

dinoworm 🐛 / patchcore



Commit 85730efaa473bd6bfa0d09479556900d31635bfb

throttle recent channels update to 1 second

Matt McKegg committed on 6/17/2017, 2:38:04 PM
Parent: 87348ff76df831f71fd01fa26a86ad4dca428916

Files changed

channel/obs/recent.jschanged
channel/obs/recent.jsView
@@ -1,8 +1,8 @@
11 var nest = require('depnest')
22 var pull = require('pull-stream')
33
4-var { Value, Dict, Struct, computed, resolve } = require('mutant')
4 +var { Value, Dict, Struct, computed, resolve, throttle } = require('mutant')
55
66 exports.needs = nest({
77 'sbot.pull.backlinks': 'first'
88 })
@@ -80,12 +80,12 @@
8080 if (err) throw err
8181 sync.set(true)
8282 })
8383 )
84- recentChannels = computed(channelsLookup, (lookup) => {
84 + recentChannels = computed(throttle(channelsLookup, 1000), (lookup) => {
8585 var values = Object.keys(lookup).map(x => lookup[x]).sort((a, b) => b.updatedAt - a.updatedAt).map(x => x.id.slice(1))
8686 return values
87- }, {nextTick: true})
87 + })
8888 recentChannels.sync = sync
8989 }
9090 }
9191 }

Built with git-ssb-web