package demo.simple.queue.config;

import com.github.microservice.components.data.mongo.queue.config.ExecQueueConfig;
import org.springframework.context.annotation.Configuration;

import java.util.Map;

@Configuration
public class QueueConfig extends ExecQueueConfig {

    private static final Map<Integer, Long> SleepTime = Map.of(
            1, 2000L,
            2, 3000L,
            3, 5000L,
            4, 7000L,
            5, 11000L
    );

    @Override
    public long sleepTime(int tryIndex) {
        return SleepTime.getOrDefault(tryIndex, 1000L * 60);
    }
}
