mirror of
https://github.com/Lumither/nocturne.git
synced 2026-10-18 19:06:21 +00:00
feat(cron::update) auto update git repo and update db index
This commit is contained in:
18 files changed
+882
-39
No files matched your search
@@ -0,0 +1,14 @@
|
||||
use git2::opts::{set_server_connect_timeout_in_milliseconds, set_server_timeout_in_milliseconds};
|
||||
use tracing::warn;
|
||||
|
||||
pub fn init() {
|
||||
// git2 option
|
||||
unsafe {
|
||||
if let Err(e) = set_server_connect_timeout_in_milliseconds(10_000) {
|
||||
warn!("failed to set git2 server connect timeout: {}", e);
|
||||
}
|
||||
if let Err(e) = set_server_timeout_in_milliseconds(60_000) {
|
||||
warn!("failed to set git2 server timeout: {}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
mod cron;
|
||||
mod database;
|
||||
pub mod logger;
|
||||
mod misc;
|
||||
mod schema;
|
||||
pub mod server;
|
||||
|
||||
@@ -24,6 +25,8 @@ pub fn load_env() {
|
||||
}
|
||||
|
||||
pub async fn start() {
|
||||
misc::init();
|
||||
|
||||
// connect database
|
||||
let db_pool = match database::init().await {
|
||||
Ok(pool) => {
|
||||
|
||||
@@ -7,11 +7,11 @@ CREATE TABLE IF NOT EXISTS Post
|
||||
post_id UUID PRIMARY KEY,
|
||||
title VARCHAR(255) NOT NULL,
|
||||
category VARCHAR(255) NOT NULL,
|
||||
header_img TEXT,
|
||||
filename TEXT UNIQUE NOT NULL,
|
||||
summary TEXT,
|
||||
sub_title TEXT,
|
||||
content TEXT NOT NULL,
|
||||
last_update TIMESTAMPTZ NOT NULL,
|
||||
last_update TIMESTAMPTZ,
|
||||
first_update TIMESTAMPTZ NOT NULL
|
||||
);
|
||||
"##;
|
||||
|
||||
Reference in new issue
Block a user