Commit 34a8a0e3 authored by project's avatar project

--no commit message

--no commit message
parent 221e9b4e
var ctx = require('../../../context'); var ctx = require('../../../context');
var fs = require('fs'); var fs = require('fs');
var BinStream = ctx.getLib('lib/bss/binarystream_v1_1'); var BinStream = ctx.getLib('lib/bss/binarystream_v1_1');
var async = require('async');
function perform_function(context,request,response){ function perform_function(context,request,response){
var job_id = context.jobconfig.job_id; var job_id = context.jobconfig.job_id;
...@@ -44,17 +45,35 @@ function bss_write(fn,meta,data,response) ...@@ -44,17 +45,35 @@ function bss_write(fn,meta,data,response)
response.error(err); response.error(err);
return; return;
} }
bss.write(data,{meta:meta},function(err,obj){
if(!err){ var arrData = [];
bss.close(function(err){
response.success(); if(!Array.isArray(data)){
}); arrData.push(data);
}else{ }else{
bss.close(function(err){ arrData = data;
response.error("ERROR"); }
});
} var idx = 0;
}); async.whilst(
function() { return idx < arrData.length; },
function(callback) {
bss.write(arrData,{meta:meta},function(err,obj){
callback(err);
});
},
function (err) {
if(!err){
bss.close(function(err){
response.success();
});
}else{
bss.close(function(err){
response.error("ERROR");
});
}
}
);
}); });
} }
......
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