Make playlist generation async
This should allow other requests to be answered while we wait for ffmpeg to do its thing.
This commit is contained in:
@@ -14,8 +14,11 @@ use std::sync::Arc;
|
||||
use actix::{Actor, Addr};
|
||||
use actix_files::NamedFile;
|
||||
use actix_multipart as mp;
|
||||
use actix_web::web::{HttpRequest, HttpResponse, Json};
|
||||
use actix_web::{get, post, web, App, HttpServer, Responder};
|
||||
use actix_web::{
|
||||
middleware,
|
||||
web::{HttpRequest, HttpResponse, Json},
|
||||
};
|
||||
use notify::{watcher, DebouncedEvent, RecursiveMode, Watcher};
|
||||
use rayon::prelude::*;
|
||||
use serde::Serialize;
|
||||
@@ -157,7 +160,7 @@ async fn generate_video(
|
||||
let filename = name.to_str().expect("Filename should convert to string");
|
||||
let playlist = format!("tmp/{}.m3u8", filename);
|
||||
if let Some(path) = is_valid_path(&body.path) {
|
||||
if let Ok(child) = create_playlist(&path.to_str().unwrap(), &playlist) {
|
||||
if let Ok(child) = create_playlist(&path.to_str().unwrap(), &playlist).await {
|
||||
data.stream_manager
|
||||
.do_send(ProcessMessage(playlist.clone(), child));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user