diff --git a/src/backend/fs/boot-fs-server/src/main/kotlin/com/tencent/bkrepo/fs/server/config/RouteConfiguration.kt b/src/backend/fs/boot-fs-server/src/main/kotlin/com/tencent/bkrepo/fs/server/config/RouteConfiguration.kt index 83fcba4d0d..15b50370a6 100644 --- a/src/backend/fs/boot-fs-server/src/main/kotlin/com/tencent/bkrepo/fs/server/config/RouteConfiguration.kt +++ b/src/backend/fs/boot-fs-server/src/main/kotlin/com/tencent/bkrepo/fs/server/config/RouteConfiguration.kt @@ -112,7 +112,6 @@ class RouteConfiguration( } "/stream".nest{ - filter(artifactFileCleanupFilterFunction::filter) PUT(DEFAULT_MAPPING_URI, fileOperationsHandler::stream) addMetrics(serverMetrics.uploadingCount) } diff --git a/src/backend/fs/boot-fs-server/src/main/kotlin/com/tencent/bkrepo/fs/server/filter/ArtifactFileCleanupFilterFunction.kt b/src/backend/fs/boot-fs-server/src/main/kotlin/com/tencent/bkrepo/fs/server/filter/ArtifactFileCleanupFilterFunction.kt index 6e2a3bf690..0d117185f2 100644 --- a/src/backend/fs/boot-fs-server/src/main/kotlin/com/tencent/bkrepo/fs/server/filter/ArtifactFileCleanupFilterFunction.kt +++ b/src/backend/fs/boot-fs-server/src/main/kotlin/com/tencent/bkrepo/fs/server/filter/ArtifactFileCleanupFilterFunction.kt @@ -43,7 +43,6 @@ class ArtifactFileCleanupFilterFunction : CoHandlerFilterFunction { try { return next(request) } finally { - logger.info("start clean up") cleanup(request) } } diff --git a/src/backend/fs/boot-fs-server/src/main/kotlin/com/tencent/bkrepo/fs/server/service/FileOperationService.kt b/src/backend/fs/boot-fs-server/src/main/kotlin/com/tencent/bkrepo/fs/server/service/FileOperationService.kt index b590d7fd3f..2db97aacfc 100644 --- a/src/backend/fs/boot-fs-server/src/main/kotlin/com/tencent/bkrepo/fs/server/service/FileOperationService.kt +++ b/src/backend/fs/boot-fs-server/src/main/kotlin/com/tencent/bkrepo/fs/server/service/FileOperationService.kt @@ -52,6 +52,7 @@ import com.tencent.bkrepo.repository.pojo.node.service.NodeCreateRequest import com.tencent.bkrepo.repository.pojo.node.service.NodeSetLengthRequest import kotlinx.coroutines.flow.collect import kotlinx.coroutines.flow.onCompletion +import org.slf4j.LoggerFactory import org.springframework.core.io.buffer.DataBuffer import org.springframework.core.io.buffer.DataBufferUtils import org.springframework.web.reactive.function.server.bodyToFlow @@ -98,6 +99,7 @@ class FileOperationService( var reactiveArtifactFile = CoArtifactFileFactory.buildArtifactFile() val offset = AtomicLong(0) streamRequest.request.bodyToFlow().onCompletion { + logger.info("size: ${reactiveArtifactFile.getSize()}") if (reactiveArtifactFile.getSize() > 0) { storeBlockNode(reactiveArtifactFile, offset, user, streamRequest, true) reactiveArtifactFile.close() @@ -138,6 +140,9 @@ class FileOperationService( size = reactiveArtifactFile.getSize() ) storageManager.storeBlock(reactiveArtifactFile, blockNode) + if (!reactiveArtifactFile.isInMemory()) { + reactiveArtifactFile.getFile()?.deleteOnExit() + } offset.addAndGet(blockSize) true } else { @@ -209,4 +214,8 @@ class FileOperationService( nodeMetadata = listOf(fsAttr) ) } + + companion object { + private val logger = LoggerFactory.getLogger(FileOperationService::class.java) + } }