task-74: 隔离调度线程池、文件作业线程池和外部 Coze/图片执行池
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.nanri.aiimage.config;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -20,9 +21,9 @@ public class SchedulingConfig {
|
||||
private static final ZoneId BUSINESS_ZONE = ZoneId.of("Asia/Shanghai");
|
||||
|
||||
@Bean
|
||||
public TaskScheduler taskScheduler() {
|
||||
public TaskScheduler taskScheduler(@Value("${aiimage.scheduling.pool-size:4}") int poolSize) {
|
||||
ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
|
||||
scheduler.setPoolSize(4);
|
||||
scheduler.setPoolSize(Math.max(1, poolSize));
|
||||
scheduler.setThreadNamePrefix("aiimage-scheduling-");
|
||||
scheduler.setClock(Clock.system(BUSINESS_ZONE));
|
||||
scheduler.setWaitForTasksToCompleteOnShutdown(true);
|
||||
|
||||
Reference in New Issue
Block a user