Skip to content

Commit

Permalink
fix: 🐛 loop lock
Browse files Browse the repository at this point in the history
  • Loading branch information
touv committed Nov 29, 2024
1 parent 8525706 commit 81337b9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions packages/conditor/src/openalex-fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,10 @@ export default async function OAFetch(data, feed) {
const output = ezs.createStream(ezs.objectMode());
const response = await retry(request(cURL.href, parameters), options);
const { results, meta } = await response.json();
await loop(output, results, meta?.next_cursor);
await feed.flow(output);
await Promise.all([
loop(output, results, meta?.next_cursor),
feed.flow(output),
]);
} catch (e) {
onError(e);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/conditor/test/oa-fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('openalexfetch', () => {
const input = [
{
filter: 'authorships.author.id:a5000387389',
'per-page': 20,
'per-page': 200,
},
];
const output = [];
Expand Down

0 comments on commit 81337b9

Please sign in to comment.