Drain all pending requests from a core's SPSC queue and send back `CoreDegraded` error responses. Used when the watchdog has flagged the core as unhealthy.
(core: &mut CoreLoop, core_id: usize)
| 382 | /// `CoreDegraded` error responses. Used when the watchdog has flagged |
| 383 | /// the core as unhealthy. |
| 384 | fn drain_and_reject(core: &mut CoreLoop, core_id: usize) { |
| 385 | core.drain_requests(); |
| 386 | while let Some(task) = core.task_queue.pop_front() { |
| 387 | let response = Response { |
| 388 | request_id: task.request_id(), |
| 389 | status: Status::Error, |
| 390 | attempt: 1, |
| 391 | partial: false, |
| 392 | payload: Payload::empty(), |
| 393 | watermark_lsn: core.watermark, |
| 394 | error_code: Some(ErrorCode::Internal { |
| 395 | detail: format!("core-{core_id} is degraded after repeated panics"), |
| 396 | }), |
| 397 | }; |
| 398 | if let Err(e) = core |
| 399 | .response_tx |
| 400 | .try_push(BridgeResponse { inner: response }) |
| 401 | { |
| 402 | warn!(core_id, error = %e, "failed to send degraded-rejection response"); |
| 403 | } |
| 404 | } |
| 405 | } |
| 406 | |
| 407 | /// Compute heartbeat interval with ±100ms jitter. |
| 408 | /// |
no test coverage detected