package com.ruoyi.jarvis.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

import java.util.concurrent.Executor;

@Configuration
public class GoofishAsyncConfig {

    @Bean("goofishTaskExecutor")
    public Executor goofishTaskExecutor() {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        // 仅用于未配置 RocketMQ 时 HTTP 回调路径的 @Async；过小易在拉单/回调并发时排队拖慢企微通知
        executor.setCorePoolSize(4);
        executor.setMaxPoolSize(16);
        executor.setQueueCapacity(500);
        executor.setThreadNamePrefix("goofish-");
        executor.initialize();
        return executor;
    }
}
