pull-git-repo
Advanced tools
Comparing version 0.6.1 to 0.6.2
35
index.js
@@ -938,1 +938,36 @@ var buffered = require('pull-buffered') | ||
} | ||
function callWithTimeout(fn, timeout, cb) { | ||
var timer = setTimeout(function () { | ||
timer = null | ||
cb(true) | ||
cb = function () {} | ||
}, timeout) | ||
fn.call(this, function () { | ||
clearTimeout(timer) | ||
cb.apply(this, arguments) | ||
}) | ||
} | ||
R.getFirstAvailableRev = function (timeout, cb) { | ||
var self = this | ||
var lastErr = null | ||
return function (readRev) { | ||
readRev(null, function next(err, rev) { | ||
if (err === true) return cb(lastErr) | ||
if (err) return cb(err) | ||
callWithTimeout(function (cb) { | ||
self.getObjectFromAny(rev, cb) | ||
}, timeout, function (err, obj) { | ||
if (!err && obj) { | ||
readRev(true, function (err) { | ||
cb(err === true ? null : err, rev) | ||
}) | ||
} else { | ||
lastErr = err | ||
readRev(null, next) | ||
} | ||
}) | ||
}) | ||
} | ||
} |
{ | ||
"name": "pull-git-repo", | ||
"version": "0.6.1", | ||
"version": "0.6.2", | ||
"description": "utility methods for git repos using pull streams", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -198,2 +198,10 @@ # pull-git-repo | ||
#### `repo.getFirstAvailableRev(timeout, cb): sink(rev)` | ||
Pull revs into this sink, and it will try to retrieve them, and callback the | ||
first one that resolves within the given timeout. | ||
- `timeout`: milliseconds to wait for a rev before giving up on it | ||
- `rev`: hash of an object to try to retrieve | ||
## License | ||
@@ -200,0 +208,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 4 instances in 1 package
951
215
0
34279
4