Closed baerwang closed 7 months ago
pub async fn execute() -> Result<String, JobSchedulerError> { let sched = JobScheduler::new().await?; let task = Job::new_repeated(Duration::from_secs(20), move |_uuid, _l| { let resp = reqwest::Client::new() .get("https://example.com") .timeout(Duration::from_secs(3)) .send() .await? .text() .await?; println!("{:?}", resp) })?; let uuid = sched.add(task).await?; sched.start().await?; Ok(uuid.to_string()) }