| 387 | } |
| 388 | |
| 389 | pub async fn handle_notification( |
| 390 | plugin: Plugin<PluginState>, |
| 391 | value: serde_json::Value, |
| 392 | ) -> Result<(), anyhow::Error> { |
| 393 | if let Some(sht) = value.get("shutdown") { |
| 394 | log::info!("Got shutdown notification: {}", sht); |
| 395 | /* This seems to error when subscribing to "*" notifications */ |
| 396 | _ = plugin.shutdown(); |
| 397 | process::exit(0); |
| 398 | } |
| 399 | match plugin.state().notification_sender.send(value).await { |
| 400 | Ok(()) => Ok(()), |
| 401 | Err(e) => Err(anyhow!("Error sending notification: {}", e)), |
| 402 | } |
| 403 | } |
| 404 | |
| 405 | pub async fn swagger_redirect_middleware( |
| 406 | Extension(swagger_path): Extension<String>, |