2023-12-20 19:29:13 +00:00
|
|
|
package stirling.software.SPDF.config.security;
|
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
@Component
|
|
|
|
public class RateLimitResetScheduler {
|
|
|
|
|
|
|
|
private final IPRateLimitingFilter rateLimitingFilter;
|
|
|
|
|
|
|
|
public RateLimitResetScheduler(IPRateLimitingFilter rateLimitingFilter) {
|
|
|
|
this.rateLimitingFilter = rateLimitingFilter;
|
|
|
|
}
|
|
|
|
|
2023-12-29 20:48:21 +00:00
|
|
|
@Scheduled(cron = "0 0 0 * * MON") // At 00:00 every Monday TODO: configurable
|
2023-12-20 19:29:13 +00:00
|
|
|
public void resetRateLimit() {
|
|
|
|
rateLimitingFilter.resetRequestCounts();
|
|
|
|
}
|
|
|
|
}
|