Add fmt options and move handlers

This commit is contained in:
Tobias Reisinger 2023-11-29 14:27:46 +01:00
parent 50bcac2a1b
commit fdca5b7277
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
28 changed files with 85 additions and 70 deletions
emgauwa-controller/src

View file

@ -1,21 +1,20 @@
use std::time::Duration;
use crate::relay_loop::run_relay_loop;
use crate::settings::Settings;
use emgauwa_lib::constants::WEBSOCKET_RETRY_TIMEOUT;
use emgauwa_lib::db::{DbController, DbRelay};
use emgauwa_lib::handlers::v1::ws::controllers::ControllerWsAction;
use emgauwa_lib::models::{Controller, FromDbModel};
use emgauwa_lib::types::ControllerUid;
use emgauwa_lib::types::{ControllerUid, ControllerWsAction};
use emgauwa_lib::{db, utils};
use futures::{SinkExt, StreamExt};
use sqlx::pool::PoolConnection;
use sqlx::Sqlite;
use tokio::time;
use tokio_tungstenite::connect_async;
use tokio_tungstenite::tungstenite::protocol::Message;
use tokio_tungstenite::tungstenite::Error;
use tokio_tungstenite::{connect_async, tungstenite::protocol::Message};
use utils::init_logging;
use crate::relay_loop::run_relay_loop;
use crate::settings::Settings;
mod driver;
mod relay_loop;
mod settings;
@ -123,7 +122,7 @@ async fn main() {
}
}
pub async fn handle_message(message_result: Result<Message, Error>) {
async fn handle_message(message_result: Result<Message, Error>) {
match message_result {
Ok(message) => {
if let Message::Text(msg_text) = message {

View file

@ -1,8 +1,10 @@
use crate::settings::Settings;
use chrono::Local;
use std::time::Duration;
use chrono::Local;
use tokio::time;
use crate::settings::Settings;
#[allow(unused_variables)]
pub async fn run_relay_loop(settings: Settings) {
let default_duration = Duration::from_millis(1000);