jobs.rs 899 B

1234567891011121314151617181920212223242526272829303132
  1. // Function to match the scheduled job function with its corresponding handler.
  2. // In case you want to add a new one, just add a new clause to the match with
  3. // the job name and the corresponding function.
  4. // Further info could be find in src/jobs.rs
  5. use super::Context;
  6. pub async fn handle_job(
  7. ctx: &Context,
  8. name: &String,
  9. metadata: &serde_json::Value,
  10. ) -> anyhow::Result<()> {
  11. match name.as_str() {
  12. "docs_update" => super::docs_update::handle_job().await,
  13. "rustc_commits" => {
  14. super::rustc_commits::synchronize_commits_inner(ctx, None).await;
  15. Ok(())
  16. }
  17. _ => default(&name, &metadata),
  18. }
  19. }
  20. fn default(name: &String, metadata: &serde_json::Value) -> anyhow::Result<()> {
  21. tracing::trace!(
  22. "handle_job fell into default case: (name={:?}, metadata={:?})",
  23. name,
  24. metadata
  25. );
  26. Ok(())
  27. }