type signatures
This commit is contained in:
parent
6b5c0beeaa
commit
ec4483ae5d
1 changed files with 6 additions and 5 deletions
11
src/main.rs
11
src/main.rs
|
@ -75,7 +75,7 @@ async fn main() -> eyre::Result<()> {
|
||||||
reg.register_helper("duration", Box::new(helpers::duration));
|
reg.register_helper("duration", Box::new(helpers::duration));
|
||||||
debug!(duration = ?start.elapsed(), "registered all templates");
|
debug!(duration = ?start.elapsed(), "registered all templates");
|
||||||
|
|
||||||
let reg = Arc::new(RwLock::new(reg));
|
let registry = Arc::new(RwLock::new(reg));
|
||||||
|
|
||||||
debug!("setting up watcher");
|
debug!("setting up watcher");
|
||||||
let watcher_token = cancellation_token.child_token();
|
let watcher_token = cancellation_token.child_token();
|
||||||
|
@ -83,7 +83,7 @@ async fn main() -> eyre::Result<()> {
|
||||||
watch_templates(
|
watch_templates(
|
||||||
config.dirs.custom_templates.clone(),
|
config.dirs.custom_templates.clone(),
|
||||||
watcher_token.clone(),
|
watcher_token.clone(),
|
||||||
reg.clone(),
|
registry.clone(),
|
||||||
)
|
)
|
||||||
.instrument(info_span!("custom_template_watcher")),
|
.instrument(info_span!("custom_template_watcher")),
|
||||||
);
|
);
|
||||||
|
@ -112,7 +112,8 @@ async fn main() -> eyre::Result<()> {
|
||||||
.map(|cache| CacheGuard::new(cache, config.cache.clone()))
|
.map(|cache| CacheGuard::new(cache, config.cache.clone()))
|
||||||
.map(Arc::new);
|
.map(Arc::new);
|
||||||
|
|
||||||
let posts = Arc::new(MarkdownPosts::new(Arc::clone(&config), cache.clone()).await?);
|
let posts: Arc<dyn PostManager + Send + Sync> =
|
||||||
|
Arc::new(MarkdownPosts::new(Arc::clone(&config), cache.clone()).await?);
|
||||||
|
|
||||||
if config.cache.enable && config.cache.cleanup {
|
if config.cache.enable && config.cache.cleanup {
|
||||||
if let Some(millis) = config.cache.cleanup_interval {
|
if let Some(millis) = config.cache.cleanup_interval {
|
||||||
|
@ -137,8 +138,8 @@ async fn main() -> eyre::Result<()> {
|
||||||
|
|
||||||
let state = AppState {
|
let state = AppState {
|
||||||
config: Arc::clone(&config),
|
config: Arc::clone(&config),
|
||||||
posts: posts as Arc<dyn PostManager + Send + Sync>,
|
posts,
|
||||||
templates: Arc::clone(®),
|
templates: registry,
|
||||||
};
|
};
|
||||||
let app = app::new(&config).with_state(state.clone());
|
let app = app::new(&config).with_state(state.clone());
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue