From e9b1ee71a12fcd6c15a2f0b06671bc819da98303 Mon Sep 17 00:00:00 2001 From: cel Date: Tue, 6 Jun 2017 20:50:08 -1000 Subject: Don't call blobs.want if we already have the blob --- lib/app.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib/app.js') diff --git a/lib/app.js b/lib/app.js index d86b4b9..b9e1924 100644 --- a/lib/app.js +++ b/lib/app.js @@ -172,6 +172,17 @@ App.prototype.publish = function (content, cb) { tryPublish(2) } +App.prototype.wantSizeBlob = function (id, cb) { + var blobs = this.sbot.blobs + blobs.size(id, function (err, size) { + if (size != null) return cb(null, size) + blobs.want(id, function (err) { + if (err) return cb(err) + blobs.size(id, cb) + }) + }) +} + App.prototype.addBlob = function (cb) { var done = multicb({pluck: 1, spread: true}) var hashCb = done() -- cgit v1.2.3