SSH2.SFTP node.js backup script freezes with large files

微信扫一扫,分享到朋友圈

SSH2.SFTP node.js backup script freezes with large files

I’m trying to create a script to transfer files to my NAS for backup purposes.
I’m using the SSH2 module ( https://github.com/mscdex/ssh2
) to set up a SFTP connection.
For smaller files all goes well, with larger files (>500MB) it often just freezes somewhere between 70% and 100% completion.
The fastPut method, which i use for the transfers, suddenly just stops transfering, doesn’t trigger any events anymore.

I’ve taken out the relevant piece of code:

var uploadUpdate=true;
sftp.fastPut(localPath+'/'+upload, receiver.path+'/'+newDir+'/'+upload, {step:function(totalTransferred, chunk, total){
if(uploadUpdate){ //since this event will be triggered a lot I figured I should keep some time (5 sec) between the logs
uploadUpdate=false;
console.log("- Progress '"+upload+"' => "+(Math.floor(totalTransferred/total*10000)/100)+"%, "+totalTransferred+" of "+total+" bytes, chunk: "+chunk);
setTimeout(function(){
uploadUpdate=true;
},5000);
}
}}, function(err){
if(err){
if(!fileErrors[upload]) fileErrors[upload]=0;
++fileErrors[upload];
if(fileErrors[upload]==5)
console.log("'"+upload+"' failed 5 times... skipping now...");
else{
console.log("Upload of '"+upload+"' failed, re-add to queue.");
uploadsToDo.push(upload);
}
}
nextUpload();
});

Does anyone have any idea what might cause this problem?

Problem courtesy of: NullCrayfish

微信扫一扫,分享到朋友圈

SSH2.SFTP node.js backup script freezes with large files

2.15 学习总结 之 volley(HTTP库)之StringRequest

上一篇

mysql下载安装教程

下一篇

你也可能喜欢

SSH2.SFTP node.js backup script freezes with large files

长按储存图像,分享给朋友