Skip to content

Commit 41e05d4

Browse files
committed
fix
1 parent 83e06a7 commit 41e05d4

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

relay-server/src/utils/rate_limits.rs

+12-13
Original file line numberDiff line numberDiff line change
@@ -651,31 +651,30 @@ where
651651
if summary.attachment_quantity > 0 {
652652
let item_scoping = scoping.item(DataCategory::Attachment);
653653

654+
let attachment_byte_limits = self
655+
.check
656+
.apply(item_scoping, summary.attachment_quantity)?;
657+
654658
enforcement.attachments = CategoryLimit::new(
655659
DataCategory::Attachment,
656660
summary.attachment_quantity,
657-
attachment_limits.longest(),
658-
);
659-
660-
attachment_limits.merge(
661-
self.check
662-
.apply(item_scoping, summary.attachment_quantity)?,
661+
attachment_byte_limits.longest(),
663662
);
663+
attachment_limits.merge(attachment_byte_limits);
664664
}
665665
if !attachment_limits.is_limited() && summary.attachment_item_quantity > 0 {
666-
"CHECKING ATTACHMENT ITEM LIMITS";
667666
let item_scoping = scoping.item(DataCategory::AttachmentItem);
668667

668+
let attachment_item_limits = self
669+
.check
670+
.apply(item_scoping, summary.attachment_item_quantity)?;
671+
669672
enforcement.attachment_items = CategoryLimit::new(
670673
DataCategory::AttachmentItem,
671674
summary.attachment_item_quantity,
672-
attachment_limits.longest(),
673-
);
674-
675-
attachment_limits.merge(
676-
self.check
677-
.apply(item_scoping, summary.attachment_item_quantity)?,
675+
attachment_item_limits.longest(),
678676
);
677+
attachment_limits.merge(attachment_item_limits);
679678
}
680679

681680
// Only record rate limits for plain attachments. For all other attachments, it's

0 commit comments

Comments
 (0)