package com.example.sjkbf.config;

import com.google.common.util.concurrent.RateLimiter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RateLimitConfig {
    // 总带宽限制：15MB/s = 15 * 1024 * 1024 B/s
    private static final double TOTAL_BANDWIDTH = 15 * 1024 * 1024;

    @Bean
    public RateLimiter globalRateLimiter() {
        return RateLimiter.create(TOTAL_BANDWIDTH);
    }
}