token bucket rate limiting with burst + synthetic notice on delay
This commit is contained in:
parent
d4b8aa731b
commit
496bb5484a
5 changed files with 108 additions and 30 deletions
|
|
@ -407,9 +407,10 @@ async fn fetch_event(
|
|||
// The "earlier handle" is the oldest event we got, used by the shard
|
||||
// to page further back via another fetch_event call.
|
||||
let earlier_handle = if context_before > 0 && before.len() > context_before as usize {
|
||||
before.first().map(|e| match e {
|
||||
WireEvent::Message { event_id, .. } => event_id.clone(),
|
||||
WireEvent::Reaction { target_event_id, .. } => target_event_id.clone(),
|
||||
before.first().and_then(|e| match e {
|
||||
WireEvent::Message { event_id, .. } => Some(event_id.clone()),
|
||||
WireEvent::Reaction { target_event_id, .. } => Some(target_event_id.clone()),
|
||||
WireEvent::Notice { .. } => None,
|
||||
})
|
||||
} else {
|
||||
None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue