From d6deef300bff6d2eff0b9e9c4c872d2790068447 Mon Sep 17 00:00:00 2001 From: SamTV12345 <40429738+samtv12345@users.noreply.github.com> Date: Sun, 15 Sep 2024 22:31:38 +0200 Subject: [PATCH] Fixed panic while download opml --- src/controllers/podcast_controller.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/controllers/podcast_controller.rs b/src/controllers/podcast_controller.rs index 87ea32bf..c7a78174 100644 --- a/src/controllers/podcast_controller.rs +++ b/src/controllers/podcast_controller.rs @@ -14,7 +14,6 @@ use actix_web::web::{Data, Json, Path}; use actix_web::{delete, error, get, post, put, Error, HttpRequest}; use actix_web::{web, HttpResponse}; use async_recursion::async_recursion; -use futures::executor; use opml::{Outline, OPML}; use rand::rngs::ThreadRng; use rand::Rng; @@ -39,6 +38,7 @@ use crate::DBType as DbConnection; use futures_util::StreamExt; use reqwest::Client; use reqwest::header::HeaderMap; +use tokio::runtime::Runtime; use tokio::sync::mpsc; use tokio_stream::wrappers::UnboundedReceiverStream; @@ -369,10 +369,11 @@ pub async fn import_podcasts_from_opml( let moved_lobby = lobby.clone(); let conn = conn.clone(); thread::spawn(move || { + let rt = Runtime::new().unwrap(); let rng = rand::thread_rng(); let environment = ENVIRONMENT_SERVICE.get().unwrap(); let client = get_async_sync_client().build().unwrap(); - executor::block_on(insert_outline( + rt.block_on(insert_outline( outline.clone(), client.clone(), moved_lobby,