mirror of
https://github.com/natsukagami/youmubot.git
synced 2025-05-24 17:20:49 +00:00
Update to Tokio 1 and Serenity 0.10 (#9)
This commit is contained in:
parent
40f6c6e553
commit
901d55814d
19 changed files with 238 additions and 281 deletions
|
@ -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(
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue