add (probably messy) support for hot lib reload via admin command

`!admin test test1`

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-04-28 18:29:48 -04:00 committed by June
parent 76c5942b4f
commit b282c1eb6d
6 changed files with 66 additions and 1 deletions

View file

@ -27,6 +27,9 @@ use tokio::sync::{Mutex, MutexGuard};
use tracing::{error, warn};
use self::fsck::FsckCommand;
#[cfg(feature = "hot_reload")]
#[allow(unused_imports)]
use self::test_cmd::TestCommands;
use super::pdu::PduBuilder;
use crate::{
service::admin::{
@ -44,6 +47,9 @@ pub(crate) mod media;
pub(crate) mod query;
pub(crate) mod room;
pub(crate) mod server;
#[cfg(feature = "hot_reload")]
#[allow(unused_imports)]
pub(crate) mod test_cmd;
pub(crate) mod user;
const PAGE_SIZE: usize = 100;
@ -87,6 +93,10 @@ enum AdminCommand {
#[command(subcommand)]
/// - Query all the database getters and iterators
Fsck(FsckCommand),
#[cfg(feature = "hot_reload")]
#[command(subcommand)]
Test(TestCommands),
}
#[derive(Debug)]
@ -304,6 +314,8 @@ impl Service {
AdminCommand::Debug(command) => debug::process(command, body).await?,
AdminCommand::Query(command) => query::process(command, body).await?,
AdminCommand::Fsck(command) => fsck::process(command, body).await?,
#[cfg(feature = "hot_reload")]
AdminCommand::Test(command) => test_cmd::process(command, body).await?,
};
Ok(reply_message_content)