Compare commits
2 Commits
release-20
...
release-20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6530e20af2 | ||
|
|
32f4946530 |
@@ -21,6 +21,21 @@ impl Db {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn run_migrations(&self) -> Result<()> {
|
async fn run_migrations(&self) -> Result<()> {
|
||||||
|
// WAL mode - enables concurrent reads while writing
|
||||||
|
sqlx::query("PRAGMA journal_mode=WAL")
|
||||||
|
.execute(&self.pool)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
// NORMAL synchronous - faster than FULL, still safe enough
|
||||||
|
sqlx::query("PRAGMA synchronous=NORMAL")
|
||||||
|
.execute(&self.pool)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
// 5 second busy timeout - reduces "database locked" errors
|
||||||
|
sqlx::query("PRAGMA busy_timeout=5000")
|
||||||
|
.execute(&self.pool)
|
||||||
|
.await?;
|
||||||
|
|
||||||
sqlx::migrate!("./migrations").run(&self.pool).await?;
|
sqlx::migrate!("./migrations").run(&self.pool).await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,9 @@ fn format_duration(seconds: i64) -> String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn format_date(timestamp: i64) -> String {
|
fn format_date(timestamp: i64) -> String {
|
||||||
|
if timestamp <= 0 {
|
||||||
|
return "N/A".to_string();
|
||||||
|
}
|
||||||
let dt = chrono::DateTime::from_timestamp(timestamp, 0);
|
let dt = chrono::DateTime::from_timestamp(timestamp, 0);
|
||||||
match dt {
|
match dt {
|
||||||
Some(dt) => dt.format("%d/%m/%Y %H:%M").to_string(),
|
Some(dt) => dt.format("%d/%m/%Y %H:%M").to_string(),
|
||||||
|
|||||||
Reference in New Issue
Block a user