ratelimit: reduce the number of string allocations
not a huge deal, but this is technically a bit nicer
This commit is contained in:
@@ -63,14 +63,15 @@ impl NoteFilter for RateLimit {
|
||||
}
|
||||
|
||||
if entry.tokens == 0 {
|
||||
let message = self
|
||||
.message
|
||||
.as_deref()
|
||||
.unwrap_or("rate-limited: you are noting too much");
|
||||
|
||||
return OutputMessage::new(
|
||||
msg.event.id.clone(),
|
||||
Action::Reject,
|
||||
Some(
|
||||
self.message
|
||||
.clone()
|
||||
.unwrap_or("rate-limited: you are noting too much".to_string()),
|
||||
),
|
||||
Some(message.to_owned()),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user