Some cleanup.
This commit is contained in:
parent
a0064fcb4f
commit
6c25bd7eaa
@ -105,12 +105,9 @@ pub fn index_loop(db: SqliteConnection) -> Result<()> {
|
|||||||
req.read_to_string(&mut buf)?;
|
req.read_to_string(&mut buf)?;
|
||||||
let chan = rss::Channel::from_str(&buf)?;
|
let chan = rss::Channel::from_str(&buf)?;
|
||||||
|
|
||||||
let mut pd = Podcast::new();
|
let fakedb = bar.lock().unwrap();
|
||||||
|
let pd = index_podcast(&fakedb, &chan, source)?;
|
||||||
{
|
drop(fakedb);
|
||||||
let fakedb = bar.lock().unwrap();
|
|
||||||
pd = index_podcast(&fakedb, &chan, source)?;
|
|
||||||
}
|
|
||||||
|
|
||||||
let foo: Vec<_> = chan.items()
|
let foo: Vec<_> = chan.items()
|
||||||
.par_iter()
|
.par_iter()
|
||||||
@ -121,8 +118,9 @@ pub fn index_loop(db: SqliteConnection) -> Result<()> {
|
|||||||
info!("{:#?}", foo);
|
info!("{:#?}", foo);
|
||||||
let _: Vec<_> = foo.par_iter()
|
let _: Vec<_> = foo.par_iter()
|
||||||
.map(|x| {
|
.map(|x| {
|
||||||
let z = bar.clone();
|
let dbmutex = bar.clone();
|
||||||
baz(z, x)
|
let db = dbmutex.lock().unwrap();
|
||||||
|
index_episode(&db, &x).unwrap();
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
@ -132,12 +130,6 @@ pub fn index_loop(db: SqliteConnection) -> Result<()> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn baz(arc: Arc<Mutex<SqliteConnection>>, ep: &NewEpisode) -> Result<()> {
|
|
||||||
let db = arc.lock().unwrap();
|
|
||||||
index_episode(&db, ep)?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: refactor into an Iterator
|
// TODO: refactor into an Iterator
|
||||||
// TODO: After fixing etag/lmod, add sent_etag:bool arg and logic to bypass it.
|
// TODO: After fixing etag/lmod, add sent_etag:bool arg and logic to bypass it.
|
||||||
pub fn fetch_feeds(connection: &SqliteConnection) -> Result<Vec<(reqwest::Response, Source)>> {
|
pub fn fetch_feeds(connection: &SqliteConnection) -> Result<Vec<(reqwest::Response, Source)>> {
|
||||||
|
|||||||
@ -108,17 +108,6 @@ pub struct Podcast {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Podcast {
|
impl Podcast {
|
||||||
pub fn new() -> Podcast {
|
|
||||||
Podcast {
|
|
||||||
id: 0,
|
|
||||||
title: String::new(),
|
|
||||||
link: String::new(),
|
|
||||||
description: String::new(),
|
|
||||||
image_uri: None,
|
|
||||||
source_id: 0,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn id(&self) -> i32 {
|
pub fn id(&self) -> i32 {
|
||||||
self.id
|
self.id
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user