From d8fcf7b01516213941fe4d5b0782f14860b3cba1 Mon Sep 17 00:00:00 2001 From: phiresky Date: Fri, 7 Jun 2019 23:17:33 +0200 Subject: [PATCH] fix caching --- src/adapters/ffmpeg.rs | 1 - src/caching_writer.rs | 1 + src/preproc.rs | 6 ++++-- src/preproc_cache.rs | 3 +++ 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/adapters/ffmpeg.rs b/src/adapters/ffmpeg.rs index 553cafb..40274d0 100644 --- a/src/adapters/ffmpeg.rs +++ b/src/adapters/ffmpeg.rs @@ -78,7 +78,6 @@ impl FileAdapter for FFmpegAdapter { if !probe.status.success() { return Err(format_err!("ffprobe failed: {:?}", probe.status)); } - println!("{}", String::from_utf8_lossy(&probe.stdout)); let p: FFprobeOutput = serde_json::from_slice(&probe.stdout)?; (p.streams.iter().count() > 0) }; diff --git a/src/caching_writer.rs b/src/caching_writer.rs index 8f5bb8a..305a645 100644 --- a/src/caching_writer.rs +++ b/src/caching_writer.rs @@ -1,4 +1,5 @@ use failure::Fallible; +use log::*; use std::io::Write; /** diff --git a/src/preproc.rs b/src/preproc.rs index 058337b..b000296 100644 --- a/src/preproc.rs +++ b/src/preproc.rs @@ -97,8 +97,10 @@ pub fn rga_preproc(ai: AdaptInfo) -> Result<(), Error> { .finish()?; if let Some(cached) = compressed { eprintln!("compressed len: {}", cached.len()); - }; - Ok(None) + Ok(Some(cached)) + } else { + Ok(None) + } }), Box::new(|cached| { let stdouti = std::io::stdout(); diff --git a/src/preproc_cache.rs b/src/preproc_cache.rs index ce9ba3b..7b0b8e4 100644 --- a/src/preproc_cache.rs +++ b/src/preproc_cache.rs @@ -1,4 +1,5 @@ use failure::{format_err, Fallible}; +use log::*; use std::sync::{Arc, RwLock}; pub fn open() -> Fallible>> { @@ -71,10 +72,12 @@ impl PreprocCache for LmdbCache { match cached { Some(rkv::Value::Blob(cached)) => { + debug!("got cached"); callback(cached)?; } Some(_) => Err(format_err!("Integrity: value not blob"))?, None => { + debug!("did not get cached"); drop(reader); if let Some(got) = runner()? { let mut writer = db_env.write().map_err(|p| {