Refactor the utils (remove them)
This commit is contained in:
parent
bb982c4444
commit
b065c8dd97
6 changed files with 53 additions and 110 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue