Refactor the utils (remove them)

This commit is contained in:
Tobias Reisinger 2024-05-29 00:59:08 +02:00
parent bb982c4444
commit b065c8dd97
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
6 changed files with 53 additions and 110 deletions

View file

@ -1,7 +1,7 @@
use std::sync::Arc;
use std::time::{Duration, Instant};
use actix::{Actor, Context, Handler, Message};
use actix::{Actor, Addr, Context, Handler, Message};
use emgauwa_common::constants;
use emgauwa_common::db::DbSchedule;
use emgauwa_common::errors::EmgauwaError;
@ -84,6 +84,20 @@ impl AppState {
pub fn notify_relay_change(&self) {
self.relay_notifier.notify_one();
}
pub async fn trigger_reload(app_state: &Addr<AppState>) -> Result<(), EmgauwaError> {
app_state
.send(Reload {})
.await
.map_err(EmgauwaError::from)?
}
pub async fn get_this(app_state: &Addr<AppState>) -> Result<Controller, EmgauwaError> {
app_state
.send(GetThis {})
.await
.map_err(EmgauwaError::from)
}
}
impl Actor for AppState {