ssb-git-repo
Advanced tools
Comparing version 1.6.2 to 1.6.3
@@ -54,2 +54,17 @@ var pull = require('pull-stream') | ||
function getBlobWithTimeout(blobs, timeout, key, cb) { | ||
if (!key) return cb(new Error('Missing blob key')) | ||
var timer = setTimeout(function () { | ||
timer = null | ||
cb(new Error('Timed out waiting for blob \'' + key + '\'')) | ||
}, timeout) | ||
blobs.want(key, function (err, got) { | ||
if (!timer) return console.error('Got blob after timeout', key, err || got) | ||
clearTimeout(timer) | ||
if (err) cb(err) | ||
else if (!got) cb(new Error('Unable to get blob ' + key)) | ||
else cb(null, blobs.get(key)) | ||
}) | ||
} | ||
function getMentions(repo, pack, cb) { | ||
@@ -222,9 +237,3 @@ var done = multicb({ pluck: 1, spread: true }) | ||
Repo.prototype._getBlob = function (key, cb) { | ||
if (!key) return cb(new Error('Missing blob key')) | ||
var blobs = this.sbot.blobs | ||
blobs.want(key, function (err, got) { | ||
if (err) cb(err) | ||
else if (!got) cb(new Error('Unable to get blob ' + key)) | ||
else cb(null, blobs.get(key)) | ||
}) | ||
getBlobWithTimeout(this.sbot.blobs, 30e3, key, cb) | ||
} | ||
@@ -231,0 +240,0 @@ |
{ | ||
"name": "ssb-git-repo", | ||
"version": "1.6.2", | ||
"version": "1.6.3", | ||
"description": "git repos in secure-scuttlebutt", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
32530
920