mirror of
https://github.com/natsukagami/youmubot.git
synced 2025-05-24 01:00: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
|
@ -10,14 +10,14 @@ edition = "2018"
|
|||
anyhow = "1.0"
|
||||
async-trait = "0.1"
|
||||
futures-util = "0.3"
|
||||
tokio = { version = "0.2", features = ["time"] }
|
||||
tokio = { version = "1", features = ["time"] }
|
||||
youmubot-db = { path = "../youmubot-db" }
|
||||
reqwest = "0.10"
|
||||
reqwest = "0.11"
|
||||
chrono = "0.4"
|
||||
flume = "0.9"
|
||||
dashmap = "3"
|
||||
flume = "0.10"
|
||||
dashmap = "4"
|
||||
|
||||
[dependencies.serenity]
|
||||
version = "0.9"
|
||||
version = "0.10"
|
||||
default-features = true
|
||||
features = ["collector"]
|
||||
|
|
|
@ -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