Update to Tokio 1 and Serenity 0.10 (#9)

This commit is contained in:
Natsu Kagami 2021-01-15 18:50:33 +00:00 committed by GitHub
parent 40f6c6e553
commit 901d55814d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 238 additions and 281 deletions

View file

@ -155,8 +155,7 @@ impl AnnouncerHandler {
self.data.write().await.insert::<Self>(keys.clone());
loop {
eprintln!("{}: announcer started scanning", chrono::Utc::now());
// let after_timer = after(cooldown);
let after = tokio::time::delay_for(cooldown);
let after = tokio::time::sleep_until(tokio::time::Instant::now() + cooldown);
join_all(self.announcers.iter().map(|(key, announcer)| {
eprintln!(" - scanning key `{}`", key);
Self::announce(self.data.clone(), self.cache_http.clone(), *key, announcer).map(

View file

@ -60,7 +60,7 @@ impl<'a, T> Drop for RatelimitGuard<'a, T> {
let send = self.send.clone();
let wait_time = self.wait_time.clone();
tokio::spawn(async move {
tokio::time::delay_for(wait_time).await;
tokio::time::sleep(wait_time).await;
send.send_async(()).await.ok();
});
}