ratelimit: reduce the number of string allocations
not a huge deal, but this is technically a bit nicer
This commit is contained in:
parent
77c2a8906c
commit
778c5a053b
1 changed files with 6 additions and 5 deletions
|
|
@ -63,14 +63,15 @@ impl NoteFilter for RateLimit {
|
||||||
}
|
}
|
||||||
|
|
||||||
if entry.tokens == 0 {
|
if entry.tokens == 0 {
|
||||||
|
let message = self
|
||||||
|
.message
|
||||||
|
.as_deref()
|
||||||
|
.unwrap_or("rate-limited: you are noting too much");
|
||||||
|
|
||||||
return OutputMessage::new(
|
return OutputMessage::new(
|
||||||
msg.event.id.clone(),
|
msg.event.id.clone(),
|
||||||
Action::Reject,
|
Action::Reject,
|
||||||
Some(
|
Some(message.to_owned()),
|
||||||
self.message
|
|
||||||
.clone()
|
|
||||||
.unwrap_or("rate-limited: you are noting too much".to_string()),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue