implement atomic pin reset rpc

This commit is contained in:
ansuz
2017-04-07 11:37:19 +02:00
parent 89bca1606b
commit e87992c7ec
3 changed files with 27 additions and 34 deletions

View File

@@ -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);
}
});
/*