optionally dont run web/postman
This commit is contained in:
parent
37420b2b1f
commit
cb471c52f3
24
src/main.rs
24
src/main.rs
@ -21,7 +21,7 @@ use std::{
|
|||||||
|
|
||||||
use chrono_tz::Tz;
|
use chrono_tz::Tz;
|
||||||
use dotenv::dotenv;
|
use dotenv::dotenv;
|
||||||
use log::info;
|
use log::{info, warn};
|
||||||
use serenity::{
|
use serenity::{
|
||||||
async_trait,
|
async_trait,
|
||||||
client::Client,
|
client::Client,
|
||||||
@ -88,13 +88,23 @@ impl EventHandler for Handler {
|
|||||||
let pool1 = ctx1.data.read().await.get::<SQLPool>().cloned().unwrap();
|
let pool1 = ctx1.data.read().await.get::<SQLPool>().cloned().unwrap();
|
||||||
let pool2 = ctx2.data.read().await.get::<SQLPool>().cloned().unwrap();
|
let pool2 = ctx2.data.read().await.get::<SQLPool>().cloned().unwrap();
|
||||||
|
|
||||||
tokio::spawn(async move {
|
let run_settings = env::var("DONTRUN").unwrap_or_else(|_| "".to_string());
|
||||||
postman::initialize(ctx1, &pool1).await;
|
|
||||||
});
|
|
||||||
|
|
||||||
tokio::spawn(async move {
|
if !run_settings.contains("postman") {
|
||||||
reminder_web::initialize(ctx2, pool2).await.unwrap();
|
tokio::spawn(async move {
|
||||||
});
|
postman::initialize(ctx1, &pool1).await;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
warn!("Not running postman")
|
||||||
|
}
|
||||||
|
|
||||||
|
if !run_settings.contains("web") {
|
||||||
|
tokio::spawn(async move {
|
||||||
|
reminder_web::initialize(ctx2, pool2).await.unwrap();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
warn!("Not running web")
|
||||||
|
}
|
||||||
|
|
||||||
self.is_loop_running.swap(true, Ordering::Relaxed);
|
self.is_loop_running.swap(true, Ordering::Relaxed);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user