Skip to content

Commit

Permalink
make reducers async
Browse files Browse the repository at this point in the history
  • Loading branch information
alecmocatta committed Jun 4, 2020
1 parent 9c5d139 commit 909e769
Show file tree
Hide file tree
Showing 34 changed files with 1,536 additions and 573 deletions.
35 changes: 17 additions & 18 deletions amadeus-aws/src/cloudfront.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,24 +104,23 @@ impl Source for Cloudfront {
.map_err(AwsError::from)
.map(|res| {
let body = res.body.unwrap().into_blocking_read();
BufReader::new(MultiGzDecoder::new(
Box::new(body) as Box<dyn io::Read + Send>
))
.lines()
.filter(|x: &Result<String, io::Error>| {
if let Ok(x) = x {
x.chars().filter(|x| !x.is_whitespace()).nth(0) != Some('#')
} else {
true
}
})
.map(|x: Result<String, io::Error>| {
if let Ok(x) = x {
Ok(CloudfrontRow::from_line(&x))
} else {
Err(AwsError::from(x.err().unwrap()))
}
})
BufReader::new(MultiGzDecoder::new(body))
.lines()
.filter(|x: &Result<String, io::Error>| {
if let Ok(x) = x {
x.chars().filter(|x| !x.is_whitespace()).nth(0) != Some('#')
} else {
true
}
})
.map(|x: Result<String, io::Error>| {
if let Ok(x) = x {
println!("got row");
Ok(CloudfrontRow::from_line(&x))
} else {
Err(AwsError::from(x.err().unwrap()))
}
})
}),
))
}))
Expand Down
Loading

0 comments on commit 909e769

Please sign in to comment.