mirror of
https://github.com/chatmail/core.git
synced 2026-04-25 01:16:29 +03:00
Limit rate of MDNs
New ratelimiter module counts number of sent messages and calculates the time until more messages can be sent. Rate limiter is currently applied only to MDNs. Other messages are sent without rate limiting even if quota is exceeded, but MDNs are not sent until ratelimiter allows sending again.
This commit is contained in:
@@ -32,6 +32,11 @@ impl Smtp {
|
||||
message: &[u8],
|
||||
rowid: i64,
|
||||
) -> Result<()> {
|
||||
// Notify ratelimiter about sent message regardless of whether quota is exceeded or not.
|
||||
// Checking whether sending is allowed for low-priority messages should be done by the
|
||||
// caller.
|
||||
context.ratelimit.write().await.send();
|
||||
|
||||
let message_len_bytes = message.len();
|
||||
|
||||
let mut chunk_size = DEFAULT_MAX_SMTP_RCPT_TO;
|
||||
|
||||
Reference in New Issue
Block a user