stream-json
Some checks reported errors
continuous-integration/drone/push Build was killed

This commit is contained in:
ale 2024-10-14 00:15:11 +02:00
parent 35f3097b8e
commit 1eb0efe2a2

View File

@ -477,21 +477,23 @@ module.exports = (app, client) => {
}, { asStream: true, meta: false }),
instancescomment = [],
block_count = 0,
pipeline = chain([
parser(),
pick({ filter: 'hits.hits' }),
streamArray(),
data => {
block_count++
instancescomment.push({
instance: data.value._source.instance, comment: data.value._source.blocks.find(block => block.domain === clean(req.params.instance)).comment
})
}
])
pipeline = chain([
parser(),
pick({ filter: 'hits.hits' }),
streamArray(),
data => {
block_count++
instancescomment.push({
instance: data.value._source.instance, comment: data.value._source.blocks.find(block => block.domain === clean(req.params.instance)).comment
})
}
])
result.pipe(pipeline)
res.json({
block_count,
instances: instancescomment
pipeline.on('end', () => {
res.json({
block_count,
instances: instancescomment
})
})
} else {
res.status(404).end()