Skip to content

Commit

Permalink
Fixed panic while download opml
Browse files Browse the repository at this point in the history
  • Loading branch information
SamTV12345 committed Sep 15, 2024
1 parent 08c560f commit d6deef3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/controllers/podcast_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit d6deef3

Please sign in to comment.