[파일 업로드] tusHook 작업
- 종료인 상태 update 되지 않도록 수정
This commit is contained in:
@@ -222,21 +222,54 @@ public class FileService {
|
||||
|
||||
tusHookDto.setUploadedBytes(offset);
|
||||
|
||||
Integer currentStatus = fileUploadMetaInfo.getStatus();
|
||||
if (currentStatus != null && (currentStatus == 3 || currentStatus == 5)) {
|
||||
String t = (type == null) ? "" : type;
|
||||
if (!"post-finish".equals(t) && !"post-terminate".equals(t)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case "pre-create", "post-receive":
|
||||
case "pre-create":
|
||||
// 이미 진행 이상이면 되돌리지 않음
|
||||
if (currentStatus != null && currentStatus >= 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
tusHookDto.setStatus(1); // UPLOADING
|
||||
break;
|
||||
|
||||
case "post-receive":
|
||||
// DONE/CANCELED 이후 늦게 온 receive 이벤트 무시
|
||||
if (currentStatus != null && (currentStatus == 3 || currentStatus == 5)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
tusHookDto.setStatus(1); // UPLOADING
|
||||
break;
|
||||
|
||||
case "post-finish":
|
||||
tusHookDto.setStatus(3); // DONE
|
||||
tusHookDto.setUploadedBytes(size);
|
||||
break;
|
||||
|
||||
case "post-terminate":
|
||||
tusHookDto.setStatus(5); // CANCELED (정책에 따라 FAILED=4)
|
||||
// 이미 DONE이면 terminate 무시 (완료 우선)
|
||||
if (currentStatus != null && currentStatus == 3) {
|
||||
return false;
|
||||
}
|
||||
tusHookDto.setStatus(5); // CANCELED
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
if (tusHookDto.getStatus() == 1 && currentStatus != null && currentStatus >= 3) {
|
||||
return false;
|
||||
}
|
||||
|
||||
fileMapper.updateFileDetailStatus(tusHookDto);
|
||||
|
||||
if ("post-finish".equals(type) || "post-terminate".equals(type)) {
|
||||
|
||||
Reference in New Issue
Block a user