添加注释
This commit is contained in:
parent
80caca2dc8
commit
b8cb188bb6
@ -3,6 +3,7 @@ use library::config;
|
|||||||
mod controller;
|
mod controller;
|
||||||
mod router;
|
mod router;
|
||||||
|
|
||||||
|
/// 启动服务
|
||||||
pub async fn serve() {
|
pub async fn serve() {
|
||||||
let addr = format!("0.0.0.0:{}", config!().server.port);
|
let addr = format!("0.0.0.0:{}", config!().server.port);
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ use tokio_cron_scheduler::{JobScheduler, JobSchedulerError};
|
|||||||
|
|
||||||
pub(crate) mod task;
|
pub(crate) mod task;
|
||||||
|
|
||||||
|
/// 启动定时任务
|
||||||
pub async fn start() {
|
pub async fn start() {
|
||||||
match schedule().await {
|
match schedule().await {
|
||||||
Ok(_) => tracing::info!("定时任务启动成功"),
|
Ok(_) => tracing::info!("定时任务启动成功"),
|
||||||
|
@ -5,6 +5,7 @@ use sqlx_postgres::{PgPool, PgPoolOptions};
|
|||||||
|
|
||||||
static DB: OnceLock<PgPool> = OnceLock::new();
|
static DB: OnceLock<PgPool> = OnceLock::new();
|
||||||
|
|
||||||
|
/// 初始化数据库连接池
|
||||||
pub async fn init_database(config: &Config) {
|
pub async fn init_database(config: &Config) {
|
||||||
let db_cfg = &config.database;
|
let db_cfg = &config.database;
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ impl FormatTime for LocalTimer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 初始化日志
|
||||||
pub fn init_log(config: &Config) -> (WorkerGuard, WorkerGuard) {
|
pub fn init_log(config: &Config) -> (WorkerGuard, WorkerGuard) {
|
||||||
let logger_cfg = config.logger.clone();
|
let logger_cfg = config.logger.clone();
|
||||||
let (stdout_tracing_appender, std_guard) = tracing_appender::non_blocking(std::io::stdout());
|
let (stdout_tracing_appender, std_guard) = tracing_appender::non_blocking(std::io::stdout());
|
||||||
|
Loading…
Reference in New Issue
Block a user