增加线程配置,采用动态并发管理

This commit is contained in:
2025-09-06 11:04:57 +08:00
parent 3e910e14a4
commit 1142d55b24
7 changed files with 300 additions and 9 deletions
+9 -3
View File
@@ -170,7 +170,9 @@ class DownloadExecutor {
* 执行批量下载
*/
async executeBatchDownload(task, artworkIds, options) {
const { concurrent = 3, size = 'original', quality = 'high', format = 'auto' } = options;
// 获取动态并发配置
const concurrentConfig = await this.downloadService.getConcurrentConfig();
const { concurrent = concurrentConfig.concurrentDownloads, size = 'original', quality = 'high', format = 'auto' } = options;
try {
const results = [];
@@ -292,7 +294,9 @@ class DownloadExecutor {
* 执行作者作品下载
*/
async executeArtistDownload(task, newArtworks, options) {
const { maxConcurrent = 3, size = 'original', quality = 'high', format = 'auto' } = options;
// 获取动态并发配置
const concurrentConfig = await this.downloadService.getConcurrentConfig();
const { maxConcurrent = concurrentConfig.maxConcurrentFiles, size = 'original', quality = 'high', format = 'auto' } = options;
try {
const results = [];
@@ -409,7 +413,9 @@ class DownloadExecutor {
* 执行排行榜作品下载
*/
async executeRankingDownload(task, newArtworks, options) {
const { maxConcurrent = 3, size = 'original', quality = 'high', format = 'auto' } = options;
// 获取动态并发配置
const concurrentConfig = await this.downloadService.getConcurrentConfig();
const { maxConcurrent = concurrentConfig.maxConcurrentFiles, size = 'original', quality = 'high', format = 'auto' } = options;
try {
const results = [];