Compare commits

..

No commits in common. 'fae98150cd23158a9d08e3f9a3a565f4779a3ccf' and '7a0967741d9604bd8f246c0f7af2f50f1f17e4f9' have entirely different histories.

@ -8,18 +8,16 @@ use std::{
task::{Context, Poll}, task::{Context, Poll},
sync::Arc, sync::Arc,
thread::{JoinHandle, self}, thread::{JoinHandle, self},
net::SocketAddr,
io, io,
fmt, fmt,
error, error,
panic, panic, net::SocketAddr,
}; };
use axum::{Router, Server, Extension}; use axum::{Router, Server, Extension};
use notify::{RecommendedWatcher, RecursiveMode, Watcher}; use notify::{RecommendedWatcher, RecursiveMode, Watcher};
use tera::Tera; use tera::Tera;
use tokio::sync::RwLock as TokioRwLock; use tokio::sync::RwLock as TokioRwLock;
use tracing::{debug, info, error};
use treacle::Debouncer; use treacle::Debouncer;
const DEFAULT_TEMPLATES_DEBOUNCE_TIME: Duration = Duration::from_millis(500); const DEFAULT_TEMPLATES_DEBOUNCE_TIME: Duration = Duration::from_millis(500);
@ -106,7 +104,7 @@ impl<'a, F> Mallard<'a, F> {
}, },
Err(err) => { Err(err) => {
// FIXME: custom error handler // FIXME: custom error handler
error!(error = %err, "filesystem event error"); eprintln!("Filesystem event error: {}", err);
}, },
})?; })?;
@ -120,25 +118,25 @@ impl<'a, F> Mallard<'a, F> {
move || { move || {
while let Ok(()) = debounced_rx.recv() { while let Ok(()) = debounced_rx.recv() {
debug!("reloading templates"); // FIXME: tracing
let reload_res = { let reload_res = {
let mut guard = ctx.tera().blocking_write(); let mut guard = ctx.tera().blocking_write();
guard.full_reload() guard.full_reload()
}; };
// FIXME: custom error handler
match reload_res { match reload_res {
Ok(()) => { Ok(()) => {
info!("reloaded templates"); // println!("Reloaded templates");
}, },
Err(err) => { Err(_) => {
// FIXME: custom error handler // eprintln!("Error reloading templates: {}", err);
error!(error = %err, "failed to reload templates");
}, },
} }
} }
info!("stopped template reloader thread") // println!("Stopping template reloader thread");
} }
})?; })?;
@ -237,7 +235,7 @@ impl Drop for ReloadEngine {
} }
} }
pub struct BottomFuture<T> { struct BottomFuture<T> {
bottom: Infallible, bottom: Infallible,
phantom_data: PhantomData<T>, phantom_data: PhantomData<T>,
} }

Loading…
Cancel
Save