3535//!
3636//! [Taken from]: https://discord.com/developers/docs/topics/rate-limits#rate-limits
3737
38- use std:: borrow:: Cow ;
3938use std:: fmt;
4039use std:: str:: { self , FromStr } ;
4140use std:: time:: SystemTime ;
@@ -49,6 +48,7 @@ use tracing::debug;
4948#[ cfg( feature = "tracing_instrument" ) ]
5049use tracing:: instrument;
5150
51+ use super :: routing:: OwnedRoute ;
5252pub use super :: routing:: RatelimitingBucket ;
5353use super :: { HttpError , LightMethod , Request } ;
5454use crate :: internal:: prelude:: * ;
@@ -61,7 +61,7 @@ pub struct RatelimitInfo {
6161 pub timeout : std:: time:: Duration ,
6262 pub limit : i64 ,
6363 pub method : LightMethod ,
64- pub path : Cow < ' static , str > ,
64+ pub route : OwnedRoute ,
6565 pub global : bool ,
6666}
6767
@@ -230,7 +230,7 @@ impl Ratelimiter {
230230 timeout : Duration :: from_secs_f64 ( retry_after) ,
231231 limit : 50 ,
232232 method : req. method ,
233- path : req. route . path ( ) ,
233+ route : req. route . upgrade_to_fully_owned_route ( ) ,
234234 global : true ,
235235 } ) ;
236236 sleep ( Duration :: from_secs_f64 ( retry_after) ) . await ;
@@ -324,7 +324,7 @@ impl Ratelimit {
324324 timeout : delay,
325325 limit : self . limit ,
326326 method : req. method ,
327- path : req. route . path ( ) ,
327+ route : req. route . upgrade_to_fully_owned_route ( ) ,
328328 global : false ,
329329 } ) ;
330330
@@ -382,7 +382,7 @@ impl Ratelimit {
382382 timeout : Duration :: from_secs_f64 ( retry_after) ,
383383 limit : self . limit ,
384384 method : req. method ,
385- path : req. route . path ( ) ,
385+ route : req. route . upgrade_to_fully_owned_route ( ) ,
386386 global : false ,
387387 } ) ;
388388
0 commit comments