Skip to content

Commit

Permalink
Fixing CAAQM adapter, WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
MichalCz committed Dec 5, 2018
1 parent 34b54d2 commit 3c471a1
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions adapters/caaqm.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,16 @@ export async function fetchStream (source) {

return DataStream
.from(
request(options)
.pipe(JSONStream.parse('map.station_list.*'))
() => {
const response = request(options);
const parser = JSONStream.parse('map.station_list.*');
const output = new DataStream();

parser.on('error', (e) => output.raise(e));
response.on('error', (e) => output.raise(e));

return response.pipe(parser).pipe(output);
}
)
.setOptions({maxParallel: 5})
.into(
Expand Down

0 comments on commit 3c471a1

Please sign in to comment.