(&self)
| 283 | } |
| 284 | |
| 285 | pub fn worker_statuses(&self) -> Vec<WorkerStatus> { |
| 286 | let w = self.inner.lock().unwrap(); |
| 287 | |
| 288 | let mut result = Vec::with_capacity(20); |
| 289 | for pool in w.pools.iter() { |
| 290 | for worker in pool.iter() { |
| 291 | result.push(WorkerStatus { |
| 292 | worker_id: worker.worker_id, |
| 293 | claimed_last: worker.claimed_at, |
| 294 | returned_last: worker.returned_at, |
| 295 | priority_index: worker.priority_index, |
| 296 | claimed_last_by: worker.last_active_guild, |
| 297 | currently_claimed_by: None, |
| 298 | }); |
| 299 | } |
| 300 | } |
| 301 | |
| 302 | for pool in &w.claimed_workers { |
| 303 | for claim in pool { |
| 304 | result.push(WorkerStatus { |
| 305 | worker_id: claim.worker_id, |
| 306 | claimed_last: claim.claimed_at, |
| 307 | returned_last: claim.returned_last, |
| 308 | priority_index: claim.priority_index, |
| 309 | claimed_last_by: None, |
| 310 | currently_claimed_by: Some(claim.guild_id), |
| 311 | }) |
| 312 | } |
| 313 | } |
| 314 | |
| 315 | result |
| 316 | } |
| 317 | } |
| 318 | |
| 319 | #[derive(Debug)] |
no test coverage detected