diff options
Diffstat (limited to 'lib/app.js')
-rw-r--r-- | lib/app.js | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -31,7 +31,8 @@ function App(sbot, config) { sbot.get = memo({cache: lru(100)}, sbot.get) this.getMsg = memo({cache: lru(100)}, getMsgWithValue, sbot) - this.getAbout = memo({cache: lru(100)}, getAbout.bind(this), sbot, sbot.id) + this.getAbout = memo({cache: this.aboutCache = lru(100)}, + getAbout.bind(this), sbot, sbot.id) this.unboxContent = memo({cache: lru(100)}, sbot.private.unbox) this.reverseNameCache = lru(100) @@ -47,6 +48,16 @@ App.prototype.go = function () { }).listen(self.port, self.host, function () { self.log('Listening on http://' + self.host + ':' + self.port) }) + + // invalidate cached About info when new About messages come in + pull( + self.sbot.links({rel: 'about', old: false, values: true}), + pull.drain(function (link) { + self.aboutCache.remove(link.dest) + }, function (err) { + if (err) self.error('about:', err) + }) + ) } var logPrefix = '[' + pkg.name + ']' |