| 543 | } |
| 544 | |
| 545 | pub async fn handle_notification( |
| 546 | plugin: Plugin<PluginState>, |
| 547 | value: serde_json::Value, |
| 548 | ) -> Result<(), anyhow::Error> { |
| 549 | if let Some(sht) = value.get("shutdown") { |
| 550 | log::info!("Got shutdown notification: {}", sht); |
| 551 | /* This seems to error when subscribing to "*" notifications */ |
| 552 | _ = plugin.shutdown(); |
| 553 | process::exit(0); |
| 554 | } |
| 555 | match plugin.state().notification_sender.send(value).await { |
| 556 | Ok(()) => Ok(()), |
| 557 | Err(e) => Err(anyhow!("Error sending notification: {}", e)), |
| 558 | } |
| 559 | } |
| 560 | |
| 561 | pub async fn swagger_redirect_middleware( |
| 562 | Extension(swagger_path): Extension<String>, |