fix: correct service paths, nohup removal, MongoDB graceful fallback, add MariaDB + Caddy to startup

- Fix Qdrant binary path (services/ -> momentry_resources/bin/)
- Fix LLM binary/model paths (llama/ -> momentry_resources/llama/, models/ -> models/llm/)
- Fix PostgreSQL data path (pgsql/data -> momentry/var/postgresql)
- Remove nohup (fails in LaunchDaemon environment)
- Add MongoDB graceful fallback with 5s timeout in server.rs
- Add MariaDB + Caddy steps to startup script for WordPress
- Revert all unrelated changes
This commit is contained in:
M5Max128
2026-05-23 01:46:23 +08:00
parent 3ccdf403b6
commit 1c30af9557
3 changed files with 89 additions and 18 deletions
+19
View File
@@ -80,6 +80,25 @@ impl MongoCache {
Ok(cache)
}
/// Create a disabled cache instance — all ops are no-ops (is_enabled() = false).
/// Used when MongoDB is unavailable; Redis cache continues independently.
pub async fn disabled() -> Self {
let client = Client::with_uri_str("mongodb://localhost:27017")
.await
.expect("disabled mongo client (lazy — no actual connect)");
let db = client.database("disabled_cache");
Self {
client,
db: db.clone(),
collection: db.collection("disabled"),
settings: CacheSettings {
enabled: false,
..Default::default()
},
initialized: Arc::new(RwLock::new(false)),
}
}
async fn ensure_indexes(&self) -> Result<()> {
let mut guard = self.initialized.write().await;
if *guard {