forked from TencentBlueKing/bk-repo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
impr: 优化并发和单元测试 TencentBlueKing#2161
* impr: 并发解压报错,优化代码 TencentBlueKing#2123 * impr: 增加任务执行超时 TencentBlueKing#2123 * impr: 修复单元测试 TencentBlueKing#2123 * impr: 修复单元测试 TencentBlueKing#2123
- Loading branch information
1 parent
f7ebf6c
commit 1395864
Showing
26 changed files
with
518 additions
and
311 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
...ive/biz-archive/src/main/kotlin/com/tencent/bkrepo/archive/config/ArchiveConfiguration.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
...ckend/archive/biz-archive/src/main/kotlin/com/tencent/bkrepo/archive/core/FileProvider.kt
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
...chive/biz-archive/src/main/kotlin/com/tencent/bkrepo/archive/core/PriorityFileProvider.kt
This file was deleted.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
.../archive/biz-archive/src/main/kotlin/com/tencent/bkrepo/archive/core/ReactorExtensions.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.tencent.bkrepo.archive.core | ||
|
||
import com.tencent.bkrepo.common.api.concurrent.PriorityRunnableWrapper | ||
import reactor.core.publisher.Mono | ||
import java.util.concurrent.Executor | ||
|
||
fun <T, R> Mono<T>.mapPriority(executor: Executor, seq: Int, mapping: (t: T) -> R): Mono<R> { | ||
return this.flatMap { | ||
createPriorityMono(executor, seq) { mapping(it) } | ||
} | ||
} | ||
|
||
fun <R> createPriorityMono(executor: Executor, seq: Int, mapping: () -> R): Mono<R> { | ||
return Mono.create { sink -> | ||
val wrapper = PriorityRunnableWrapper(seq) { | ||
try { | ||
sink.success(mapping()) | ||
} catch (e: Exception) { | ||
sink.error(e) | ||
} | ||
} | ||
executor.execute(wrapper) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.