Feature: BotNotificator #18

Merged
akulij merged 13 commits from dev into main 2025-06-02 11:54:14 +00:00
2 changed files with 0 additions and 7 deletions
Showing only changes of commit daf1e09176 - Show all commits

View File

@ -157,7 +157,6 @@ where
let thread =
spawn_bot_thread(controller.bot.clone(), controller.db.clone(), handler).await?;
println!("Starting notificator");
let notificator = spawn_notificator_thread(controller.clone()).await?;
let notificator = NotificatorThread::Running(Some(notificator));
@ -235,8 +234,6 @@ pub async fn spawn_notificator_thread(
match notifications {
Some(n) => {
// waiting time to send notification
println!("Will send notification after {:?}", n.wait_for());
println!("Notifications: {:#?}", n.notifications());
tokio::time::sleep(n.wait_for()).await;
'n: for n in n.notifications().into_iter() {
for user in n.get_users(&c.db).await?.into_iter() {

View File

@ -625,12 +625,10 @@ impl NotificationTime {
delta_minutes,
} => {
let delta = TimeDelta::minutes((delta_minutes + delta_hours * 60).into());
println!("Delta: {delta}");
let mut estimation = *start_time;
// super non-optimal, but fun :)
loop {
println!("Adding delta to estimation");
if estimation < now + Duration::from_secs(1) {
estimation += delta;
} else {
@ -807,7 +805,6 @@ impl BotNotification {
// immidate notification if time to do it passed
let duration = (next - now).to_std().unwrap_or(Duration::from_secs(1));
println!("Left time: {duration:?}");
// Rounding partitions of seconds
Duration::from_secs(duration.as_secs())
}
@ -890,7 +887,6 @@ impl RunnerConfig {
.filter(|f| f.left_time(&start_time, &now) > Duration::from_secs(1))
.sorted_by_key(|f| f.left_time(&start_time, &now))
.collect::<Vec<_>>();
println!("Orederd: {:#?}", ordered);
let left = match ordered.first() {
Some(notification) => notification.left_time(&start_time, &now),