git ssb

10+

Matt McKegg / patchwork



Commit 5afcd8adb631eeacf34f56504d73c1849ead71a9

throttle updating active channels

Matt McKegg committed on 3/13/2017, 5:15:39 PM
Parent: 2bf084d1a2228d946889b72f79b7a359765d0cbf

Files changed

modules/channel/obs/recent.jschanged
modules/channel/obs/recent.jsView
@@ -1,6 +1,6 @@
11 var nest = require('depnest')
2-var { Value, Dict, Struct, computed } = require('mutant')
2 +var { Value, Dict, Struct, computed, throttle } = require('mutant')
33
44 exports.gives = nest({
55 'sbot.hook.feed': true,
66 'channel.obs.recent': true
@@ -8,9 +8,9 @@
88
99 exports.create = function (api) {
1010 var channelsLookup = Dict()
1111
12- var recentChannels = computed(channelsLookup, (lookup) => {
12 + var recentChannels = computed(throttle(channelsLookup, 1000), (lookup) => {
1313 var values = Object.keys(lookup).map(x => lookup[x]).sort((a, b) => b.updatedAt - a.updatedAt).map(x => x.id)
1414 return values
1515 }, {nextTick: true})
1616

Built with git-ssb-web