Commit 85730efaa473bd6bfa0d09479556900d31635bfb
throttle recent channels update to 1 second
Matt McKegg committed on 6/17/2017, 2:38:04 PMParent: 87348ff76df831f71fd01fa26a86ad4dca428916
Files changed
channel/obs/recent.js | changed |
channel/obs/recent.js | |||
---|---|---|---|
@@ -1,8 +1,8 @@ | |||
1 | 1 … | var nest = require('depnest') | |
2 | 2 … | var pull = require('pull-stream') | |
3 | 3 … | ||
4 | -var { Value, Dict, Struct, computed, resolve } = require('mutant') | ||
4 … | +var { Value, Dict, Struct, computed, resolve, throttle } = require('mutant') | ||
5 | 5 … | ||
6 | 6 … | exports.needs = nest({ | |
7 | 7 … | 'sbot.pull.backlinks': 'first' | |
8 | 8 … | }) | |
@@ -80,12 +80,12 @@ | |||
80 | 80 … | if (err) throw err | |
81 | 81 … | sync.set(true) | |
82 | 82 … | }) | |
83 | 83 … | ) | |
84 | - recentChannels = computed(channelsLookup, (lookup) => { | ||
84 … | + recentChannels = computed(throttle(channelsLookup, 1000), (lookup) => { | ||
85 | 85 … | var values = Object.keys(lookup).map(x => lookup[x]).sort((a, b) => b.updatedAt - a.updatedAt).map(x => x.id.slice(1)) | |
86 | 86 … | return values | |
87 | - }, {nextTick: true}) | ||
87 … | + }) | ||
88 | 88 … | recentChannels.sync = sync | |
89 | 89 … | } | |
90 | 90 … | } | |
91 | 91 … | } |
Built with git-ssb-web