wait 10s before calculating next midnight for daily service
Discord logs the icon/name changes twice, with a different name each time. The guild update service is likely running twice, possibly due to faulty calculations of the next midnight - after the first run, it might calculate a very short sleep period or none at all, only sleeping until next midnight afterwards. The cause of this is unknown, but if it has to do with system time, waiting for the 10 seconds might be enough to let the system recognise the date change and allow it to sleep for the proper ~24h.
This commit is contained in:
@@ -8,6 +8,9 @@ use super::Event;
|
|||||||
pub async fn run_event_service(ctx: Context, guild_id: GuildId) {
|
pub async fn run_event_service(ctx: Context, guild_id: GuildId) {
|
||||||
loop {
|
loop {
|
||||||
update_guild(&ctx, guild_id).await.ok();
|
update_guild(&ctx, guild_id).await.ok();
|
||||||
|
|
||||||
|
// make sure temporal boundaries have been cleared
|
||||||
|
tokio::time::sleep(std::time::Duration::from_secs(10)).await;
|
||||||
sleep_until_next_midnight().await;
|
sleep_until_next_midnight().await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user