async.series(
[
function(callback){
writeLog(callback);
},
function(callback){
readLog(callback);
},
function(callback){
funcEnd(res, callback);
}
]
);
想顺序执行这三个方法,但是总是并发执行,是不是哪里写的不对呢?
function writeLog(callback){
fs.openSync(qpage,'w',0666);
for (var i = 1; i <= cnt; i++ ) {
client.hgetall(i, function(err, obj) {
fs.appendFileSync(qpage, "<br />" +util.inspect(obj), encoding='utf8');
});
}
callback(null);}
function readLog(callback){
query = fs.readFileSync(qpage, 'utf8');
callback(null);}
function funcEnd(res, callback){
res.end(query, 'utf8');
callback(null);}
5 回复