Skip to content
This repository was archived by the owner on Mar 26, 2023. It is now read-only.

Commit 482523e

Browse files
authored
Use clientId from Kafka headers instead of payload (#11)
1 parent 9a4c23a commit 482523e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/main/java/dev/ayu/matcha/KafkaRatelimitClient.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ class RatelimitClient(conn: KafkaConnection) : KafkaClient<RatelimitClientData>(
3939
type: String,
4040
) {
4141
val sourceCluster = msg.headers.sourceCluster
42+
val client = msg.headers.clientId
4243
val expiresAt = msg.value?.requestExpiresAt
43-
val client = msg.value?.client ?: "fallback"
4444
if (expiresAt != null && (expiresAt + EXPIRY_GRACE_PERIOD) < System.currentTimeMillis()) {
4545
log.info("Incoming expired '$type' quota request from client '$client' in cluster $sourceCluster, ignoring")
4646
// If the request has already expired, ignore it to not eat quotas unnecessarily

0 commit comments

Comments
 (0)