Clean up completed jobs from the internal tracking Returns the results of any completed jobs.
(&self)
| 126 | /// |
| 127 | /// Returns the results of any completed jobs. |
| 128 | pub async fn poll_completed(&self) -> Vec<Result<JobResult, JobError>> { |
| 129 | let mut results = Vec::new(); |
| 130 | let mut jobs = self.active_jobs.lock().await; |
| 131 | |
| 132 | // Collect completed jobs |
| 133 | while let Some(result) = jobs.try_join_next() { |
| 134 | match result { |
| 135 | Ok(job_result) => results.push(job_result), |
| 136 | Err(e) => results.push(Err(JobError::from(format!("Job panicked: {}", e)))), |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | results |
| 141 | } |
| 142 | |
| 143 | /// Shutdown the worker pool |
| 144 | /// |
no outgoing calls