and have generateStats and mergeGraphStats be async functions and not have to worry about error handling and pushing more than one object at a time in a read stream. We use it to process billions of events and objects a day. It makes nodejs streams fun to use.
Pretty cool. Could the following be used as a baseline to create the same functionality?
async function * nextStreamEntry() {
while(true){
const entry = yield;
const result = await processEntry(entry);
}
}
// Initialize the iterator
const iter = nextStreamEntry();
iter.next();
// For every entry of the stream
for (const monster of results) {
iter.next(monster)
}
reconbot|7 years ago
Hope you find it as useful as we do.
oliverx0|7 years ago