(&self, payload: &Json)
| 560 | } |
| 561 | |
| 562 | fn write_command(&self, payload: &Json) -> FlowResult<()> { |
| 563 | let line = serde_json::to_string(payload).map_err(|err| { |
| 564 | FlowError::Internal(format!("failed to serialize worker command: {err}")) |
| 565 | })?; |
| 566 | let writer = self |
| 567 | .writer |
| 568 | .lock() |
| 569 | .map_err(|err| FlowError::Internal(format!("worker writer lock poisoned: {err}")))?; |
| 570 | writer |
| 571 | .as_ref() |
| 572 | .ok_or_else(|| FlowError::Internal("worker command writer is closed".to_string()))? |
| 573 | .send(line) |
| 574 | } |
| 575 | |
| 576 | fn shutdown(&self) { |
| 577 | let writer = self.writer.lock().ok().and_then(|mut writer| writer.take()); |
no test coverage detected