Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 470a5e3

Browse files
Merge pull request #455 from shungang/csg/feat/develop/48424264
fix: to #50555373 修复windows下删除job后,缓冲文件不会删除的问题
2 parents c3a7c7f + 62a6150 commit 470a5e3

File tree

6 files changed

+15296
-27
lines changed

6 files changed

+15296
-27
lines changed

‎app/main/files/modals/grant-modal.js‎

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ angular.module('web').controller('grantModalCtrl', [
5252
privTypes: ['readOnly', 'all'],
5353
privType: 'readOnly'
5454
},
55+
// eslint-disable-next-line no-useless-escape
5556
policyNameReg: /^[a-z0-9A-Z\-]{1,128}$/,
5657
mailSmtp: settingsSvs.mailSmtp.get(),
5758
showEmailSettings: function() {
@@ -219,31 +220,41 @@ angular.module('web').controller('grantModalCtrl', [
219220
var title = T('simplePolicy.title'); // 简化policy授权
220221
var successMsg = T('simplePolicy.success'); // '应用policy成功'
221222

223+
let retry = 0; // policyName创建后需要等几秒才生效,故需要重试3次,使用setTimeout避免attachPolicyToUser提示policyName不存在
224+
const retryFunc = ()=>{
225+
if (retry < 3) {
226+
retry++;
227+
setTimeout(()=>{
228+
ramSvs
229+
.attachPolicyToUser(policyName, $scope.grant.userName) // 为指定用户添加权限
230+
.then(function() {
231+
// 发邮件
232+
if (sendInfo) {
233+
Mailer.send(sendInfo).then(
234+
function(result) {
235+
console.log(result);
236+
Toast.success(T('mail.test.success'));
237+
},
238+
function(err) {
239+
console.error(err);
240+
Toast.error(err);
241+
}
242+
);
243+
}
244+
245+
Toast.success(successMsg);
246+
cancel();
247+
}).catch(()=>{
248+
retryFunc(); // 递归重试
249+
});
250+
}, 1000);
251+
}
252+
};
222253
checkCreatePolicy(policyName, $scope.grant.policy, title).then(
223254
function() {
224255
switch ($scope.grant.toType) {
225256
case 'user':
226-
ramSvs
227-
.attachPolicyToUser(policyName, $scope.grant.userName)
228-
.then(function() {
229-
// 发邮件
230-
if (sendInfo) {
231-
Mailer.send(sendInfo).then(
232-
function(result) {
233-
console.log(result);
234-
Toast.success(T('mail.test.success'));
235-
},
236-
function(err) {
237-
console.error(err);
238-
Toast.error(err);
239-
}
240-
);
241-
}
242-
243-
Toast.success(successMsg);
244-
cancel();
245-
});
246-
257+
retryFunc();
247258
break;
248259
case 'group':
249260
ramSvs
@@ -294,7 +305,7 @@ angular.module('web').controller('grantModalCtrl', [
294305
}
295306
);
296307

297-
return df.promise;
308+
// return df.promise;
298309
}
299310

300311
function checkCreateUser(fn) {

‎app/main/files/transfer/downloads.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
// 下载弹窗
22
angular.module('web').controller('transferDownloadsCtrl', [
33
'$scope',
44
'$timeout',
@@ -34,7 +34,7 @@ angular.module('web').controller('transferDownloadsCtrl', [
3434
checkStartJob: checkStartJob,
3535
openLocaleFolder: function(item) {
3636
var suffix = item.status == 'finished' ? '' : '.download';
37-
37+
// eslint-disable-next-line no-undef
3838
openLocaleFolder(item.to.path + suffix);
3939
},
4040

‎node/ossstore/lib/download-job.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ DownloadJob.prototype._changeStatus = function (status, retryTimes) {
671671
if (status == "failed" || status == "stopped" || status == "finished") {
672672
self.endTime = new Date().getTime();
673673
//util.closeFD(self.keepFd);
674-
674+
util.closeFD(self.fd);// #50555373 不关闭会导致windows下删除job后,缓冲文件不会删除
675675
console.log("clear speed tid, status:", self.status);
676676
clearInterval(self.speedTid);
677677
self.speed = 0;

‎node/ossstore/lib/upload-job-util.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ function prepareChunks(filePath, checkPoints, fn) {
195195

196196
fs.stat(filePath, function (err, state) {
197197
if (err) {
198-
// callback(err);
198+
console.error(err);
199199
return;
200200
}
201201

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /