package com.github.microservice.components.data.mongo.queue.config;

import com.github.microservice.components.data.mongo.token.config.ResourceTokenConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;

@Configuration
@EnableMongoRepositories(basePackages = {"com.github.microservice.components.data.mongo.queue.dao"})
@ComponentScan("com.github.microservice.components.data.mongo.queue")
@Import(ResourceTokenConfiguration.class)
public class ExecQueueConfig {


    /**
     * 队列执行的延迟时间
     */
    public long sleepTime(int tryIndex) {
        return 3 * 1000L * tryIndex;
    }

    /**
     * work状态的执行超时时间
     */
    public long executeTimeOut() {
        return 1000L * 60;
    }

    // loop_event的间隔时间
    public long loopEventTime() {
        return 1000L;
    }

    /**
     * 最大的批量执行执行数
     */
    public int maxBatchExecuteCount() {
        return 10;
    }


}
