Refactor to use Arc's and a mutex instead of plain Rc<&Sqlcon>.

This commit is contained in:
Jordan Petridis
2017-10-18 04:14:09 +03:00
parent 5d01b735d6
commit eccbbf0fc1
3 changed files with 32 additions and 29 deletions
+3 -7
View File
@@ -83,13 +83,9 @@ pub fn index_loop(db: SqliteConnection, force: bool) -> Result<()> {
let mut f = fetch_feeds(m.clone(), force)?;
// f.par_iter_mut().for_each(|&mut (ref mut req, ref source)| {
// TODO: Once for_each is stable, uncomment above line and delete collect.
let _: Vec<_> = f.par_iter_mut()
.map(|&mut (ref mut req, ref source)| {
complete_index_from_source(req, source, m.clone()).unwrap();
})
.collect();
f.par_iter_mut().for_each(|&mut (ref mut req, ref source)| {
complete_index_from_source(req, source, m.clone()).unwrap();
});
Ok(())
}