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

@@ -41,7 +41,8 @@ define([
};
var reset = function (rpc, cb) {
rpc.send('RESET', undefined, cb);
var list = uniqueChannelList();
rpc.send('RESET', list, cb);
};
/*
@@ -54,7 +55,6 @@ define([
UNPIN all, send all
*/
// Don't use create until Cryptpad is ready
// (use Cryptpad.ready)
var create = function (cb) {

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