(&self, sandbox_id: &str)
| 60 | } |
| 61 | |
| 62 | fn sender_for(&self, sandbox_id: &str) -> broadcast::Sender<SandboxStreamEvent> { |
| 63 | let mut inner = self.inner.lock().expect("tracing bus lock poisoned"); |
| 64 | inner |
| 65 | .per_id |
| 66 | .entry(sandbox_id.to_string()) |
| 67 | .or_insert_with(|| { |
| 68 | let (tx, _rx) = broadcast::channel(1024); |
| 69 | tx |
| 70 | }) |
| 71 | .clone() |
| 72 | } |
| 73 | |
| 74 | pub fn subscribe(&self, sandbox_id: &str) -> broadcast::Receiver<SandboxStreamEvent> { |
| 75 | self.sender_for(sandbox_id).subscribe() |