Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap shared Vecs in Arc during document creation #88

Merged
merged 1 commit into from
Apr 18, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/cobalt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use yaml_rust::YamlLoader;
use chrono::{DateTime, UTC, FixedOffset};
use chrono::offset::TimeZone;
use rss::{Channel, Rss};
use std::sync::Arc;

macro_rules! walker {
($dir:expr) => {
Expand Down Expand Up @@ -100,8 +101,10 @@ pub fn build(config: &Config) -> Result<()> {
let mut handles = vec![];

// generate documents (in parallel)
// TODO I'm probably underutilizing crossbeam
crossbeam::scope(|scope| {
let post_data = Arc::new(post_data);
let layouts = Arc::new(layouts);

for doc in &documents {
trace!("Generating {}", doc.path);
let post_data = post_data.clone();
Expand Down