Skip to content

Commit

Permalink
feat: add rust blog to cron task list
Browse files Browse the repository at this point in the history
  • Loading branch information
wangjiahan committed Jul 31, 2024
1 parent b221d59 commit 15ba121
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 21 deletions.
21 changes: 0 additions & 21 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,3 @@
## [0.0.11-rust-blog](https://github.com/hedon-rust-road/compare/v0.0.10-go-blog..v0.0.11-rust-blog) - 2024-07-31

### Bug Fixes

- **(go-blog)** read link href from xml - ([3ba97fd](https://github.com/hedon-rust-road/commit/3ba97fddde9b586a55a48b4ba517dad9ba36e90b)) - wangjiahan
- **(log)** fix log level to use tracing info and error - ([54abb29](https://github.com/hedon-rust-road/commit/54abb29a1a64d0078ccf2dffae797a8dcce07d70)) - wangjiahan

### Features

- support set proxy when fetch atom - ([96936d5](https://github.com/hedon-rust-road/commit/96936d5bbfed77914fae4097ae5b08e5a844e126)) - wangjiahan
- support rust official blog - ([8a534a1](https://github.com/hedon-rust-road/commit/8a534a1601e286fbc16d32bc4b4c9314730cb196)) - wangjiahan

### Refactoring

- **(rss)** add `try_new` method for Rss to create instance easily - ([5b58de7](https://github.com/hedon-rust-road/commit/5b58de7d0861c00051462b5166c41cc1d71d46c9)) - wangjiahan
- rename `rss` to `feed` and move `feed` and `atom` below `content_feed` module - ([26a4a95](https://github.com/hedon-rust-road/commit/26a4a9538fc24bb9eae776001fe78c3697587f89)) - wangjiahan
- rename `feed` to `rss` - ([75567e8](https://github.com/hedon-rust-road/commit/75567e8bff05d9b8cea4663e0375509e73fd3e29)) - wangjiahan

### Tests

- **(atom)** add test for atom try_new function - ([8e1296c](https://github.com/hedon-rust-road/commit/8e1296c531b900e9f951c259d42230197bac191a)) - wangjiahan

<!-- generated by git-cliff -->
## [0.0.10-go-blog](https://github.com/hedon-rust-road/compare/v0.0.9-openai-host..v0.0.10-go-blog) - 2024-07-30
Expand Down
31 changes: 31 additions & 0 deletions src/cron_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,37 @@ pub async fn run_every_10_30pm(redis: Arc<Redis>, conf: Arc<Conf>) -> anyhow::Re
sched.add(go_blog_job).await?;
info!("add go_blog job");

let rust_blog_conf = Arc::new(conf.rust_blog.clone());
let rust_blog_job = Job::new_async(rust_blog_conf.cron_expression.as_str(), {
let redis = Arc::clone(&redis);
let conf = Arc::clone(&conf);
let rust_blog_conf = Arc::clone(&rust_blog_conf);
move |uuid, mut l| {
let redis = Arc::clone(&redis);
let conf = Arc::clone(&conf);
let rust_blog_conf = Arc::clone(&rust_blog_conf);
Box::pin(async move {
if let Ok(Some(ts)) = l.next_tick_for_job(uuid).await {
info!("Run rust_official_blog {}", ts);
if let Err(e) = go_blog::send_feishu_msg(
&redis,
rust_blog_conf.webhooks.clone(),
rust_blog_conf.once_post_limit,
conf.openai_api_key.clone(),
conf.openai_host.clone(),
conf.proxy.clone(),
)
.await
{
error!("rust_official_blog error: {:?}", e);
}
}
})
}
})?;
sched.add(rust_blog_job).await?;
info!("add rust_blog job");

sched.start().await?;
info!("start scheduler");

Expand Down

0 comments on commit 15ba121

Please sign in to comment.