27 lines
707 B
Rust
27 lines
707 B
Rust
use loco_rs::prelude::*;
|
|
|
|
use crate::services::subscriptions;
|
|
|
|
pub struct SendWeeklyDigest;
|
|
|
|
#[async_trait]
|
|
impl Task for SendWeeklyDigest {
|
|
fn task(&self) -> TaskInfo {
|
|
TaskInfo {
|
|
name: "send_weekly_digest".to_string(),
|
|
detail: "queue weekly digest notifications".to_string(),
|
|
}
|
|
}
|
|
|
|
async fn run(&self, app_context: &AppContext, _vars: &task::Vars) -> Result<()> {
|
|
let summary = subscriptions::send_digest(app_context, "weekly").await?;
|
|
tracing::info!(
|
|
"send_weekly_digest queued={} skipped={} posts={}",
|
|
summary.queued,
|
|
summary.skipped,
|
|
summary.post_count
|
|
);
|
|
Ok(())
|
|
}
|
|
}
|