aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/app.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/app.js b/lib/app.js
index c4683d7..ee2ec39 100644
--- a/lib/app.js
+++ b/lib/app.js
@@ -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 + ']'