aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-04-12 18:53:04 -0700
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-04-12 18:53:04 -0700
commit7cbc5c587105a7add08d250458303c47bcd0e57a (patch)
tree220a38fcbe032f84aa4b41b3aa24cd7c5947fd2b /lib
parent54a38f740689e11173e26aa7176a839f13d52452 (diff)
downloadpatchfoo-7cbc5c587105a7add08d250458303c47bcd0e57a.tar.gz
patchfoo-7cbc5c587105a7add08d250458303c47bcd0e57a.zip
Deduplicate getting follower info
Diffstat (limited to 'lib')
-rw-r--r--lib/app.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/app.js b/lib/app.js
index 2910b85..38f9f50 100644
--- a/lib/app.js
+++ b/lib/app.js
@@ -36,6 +36,10 @@ function App(sbot, config) {
this.unboxContent = memo({cache: lru(100)}, sbot.private.unbox)
this.reverseNameCache = lru(100)
+ this.getFriendInfo = memo({cache: false}, this._getFriendInfo)
+ this.getFollows = memo({cache: false}, this._getFollows)
+ this.getFollowers = memo({cache: false}, this._getFollowers)
+
this.unboxMsg = this.unboxMsg.bind(this)
this.render = new Render(this, this.opts)
@@ -216,7 +220,7 @@ App.prototype.getFollow = function (source, dest, cb) {
)
}
-App.prototype.getFollows = function (id, cb) {
+App.prototype._getFollows = function (id, cb) {
var self = this
pull(
self.sbot.links({source: id, rel: 'contact', values: true}),
@@ -233,7 +237,7 @@ App.prototype.getFollows = function (id, cb) {
)
}
-App.prototype.getFollowers = function (id, cb) {
+App.prototype._getFollowers = function (id, cb) {
var self = this
pull(
self.sbot.links({dest: id, rel: 'contact', values: true}),
@@ -250,7 +254,7 @@ App.prototype.getFollowers = function (id, cb) {
)
}
-App.prototype.getFriendInfo = function (id, cb) {
+App.prototype._getFriendInfo = function (id, cb) {
var self = this
var done = multicb({pluck: 1, spread: true})
self.getFollows(id, done())