fixed bug with throttling handler when requests are delayed

This commit is contained in:
2025-06-13 13:49:13 +08:00
parent 3774ab8ef0
commit 206bcd6319
24 changed files with 350 additions and 130 deletions

View File

@@ -20,6 +20,8 @@ public class Configuration {
@NonNull
EventExecutor eventExecutor;
@NonNull
RateLimiter rateLimiter;
@NonNull
Connection connection;
Map<String, User> users;
Map<String, Group> groups;
@@ -27,6 +29,13 @@ public class Configuration {
Authentication authentication;
Tls tls;
@Value
public static class RateLimiter {
boolean delayRequest;
int messageBufferSize;
int maxQueuedMessages;
}
@Value
public static class EventExecutor {
boolean useVirtualThreads;
@@ -133,6 +142,7 @@ public class Configuration {
int incomingConnectionsBacklogSize,
String serverPath,
EventExecutor eventExecutor,
RateLimiter rateLimiter,
Connection connection,
Map<String, User> users,
Map<String, Group> groups,
@@ -146,6 +156,7 @@ public class Configuration {
incomingConnectionsBacklogSize,
serverPath != null && !serverPath.isEmpty() && !serverPath.equals("/") ? serverPath : null,
eventExecutor,
rateLimiter,
connection,
users,
groups,

View File

@@ -14,17 +14,26 @@ public sealed interface CacheMessage {
private final String key;
}
@Getter
@RequiredArgsConstructor
abstract sealed class CacheGetResponse implements CacheMessage {
private final String key;
}
@Getter
@RequiredArgsConstructor
final class CacheValueFoundResponse extends CacheGetResponse {
private final String key;
private final CacheValueMetadata metadata;
public CacheValueFoundResponse(String key, CacheValueMetadata metadata) {
super(key);
this.metadata = metadata;
}
}
final class CacheValueNotFoundResponse extends CacheGetResponse {
public CacheValueNotFoundResponse(String key) {
super(key);
}
}
@Getter