implement atomic pin reset rpc
This commit is contained in:
1 parent
89bca1606b
commit
e87992c7ec
3 files changed
+27
-34
No files matched your search
@@ -61,26 +61,9 @@ define([
|
||||
|
||||
call.reset(function (e, response) {
|
||||
if (e) { return console.error(e); }
|
||||
|
||||
var list = call.uniqueChannelList();
|
||||
|
||||
var left = list.length;
|
||||
|
||||
// now start pinning...
|
||||
list.forEach(function (channel) {
|
||||
call.pin(channel, function (e, hash) {
|
||||
left--;
|
||||
|
||||
if (!e) {
|
||||
console.log('pinned channel [%s]. new hash is [%s]', channel, hash);
|
||||
} else {
|
||||
console.error(e);
|
||||
}
|
||||
if (left === 0) {
|
||||
console.log('done pinning');
|
||||
}
|
||||
});
|
||||
});
|
||||
else {
|
||||
return console.log('reset pin list. new hash is [%s]', response);
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
|
||||
Reference in new issue
Block a user