Commit c40c23d7 authored by Tristan Cavelier's avatar Tristan Cavelier

Updating Replicate Storage

parent 76e021e1
...@@ -26,14 +26,12 @@ var newReplicateStorage = function ( spec, my ) { ...@@ -26,14 +26,12 @@ var newReplicateStorage = function ( spec, my ) {
priv.doJob = function (command,errormessage) { priv.doJob = function (command,errormessage) {
var done = false, error_array = [], i, var done = false, error_array = [], i,
onResponseDo = function (result) { onErrorDo = function (result) {
priv.return_value_array.push(result); priv.return_value_array.push(result);
},
onFailDo = function (result) {
if (!done) { if (!done) {
error_array.push(result); error_array.push(result);
if (priv.isTheLast()) { if (priv.isTheLast()) {
that.fail ( that.error (
{status:207, {status:207,
statusText:'Multi-Status', statusText:'Multi-Status',
message:errormessage, message:errormessage,
...@@ -41,21 +39,20 @@ var newReplicateStorage = function ( spec, my ) { ...@@ -41,21 +39,20 @@ var newReplicateStorage = function ( spec, my ) {
} }
} }
}, },
onDoneDo = function (result) { onSuccessDo = function (result) {
priv.return_value_array.push(result);
if (!done) { if (!done) {
done = true; done = true;
that.done (result); that.success (result);
} }
}; };
for (i = 0; i < priv.nb_storage; i+= 1) { for (i = 0; i < priv.nb_storage; i+= 1) {
var newcommand = command.clone(); var newcommand = command.clone();
var newstorage = that.newStorage(priv.storagelist[i]); var newstorage = that.newStorage(priv.storagelist[i]);
newcommand.onResponseDo (onResponseDo); newcommand.onErrorDo (onErrorDo);
newcommand.onFailDo (onFailDo); newcommand.onSuccessDo (onSuccessDo);
newcommand.onDoneDo (onDoneDo);
that.addJob (newstorage, newcommand); that.addJob (newstorage, newcommand);
} }
command.setMaxRetry (1);
}; };
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment