From 7cbc5c587105a7add08d250458303c47bcd0e57a Mon Sep 17 00:00:00 2001 From: cel Date: Wed, 12 Apr 2017 18:53:04 -0700 Subject: Deduplicate getting follower info --- lib/app.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lib/app.js') 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()) -- cgit v1.2.3