Skip to content

Commit

Permalink
kafka bridge flushProducer timeout error not caught; fixed (#1133)
Browse files Browse the repository at this point in the history
  • Loading branch information
mipyykko committed Mar 13, 2023
1 parent c90b6da commit 8bdb5ad
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion backend/bin/kafkaBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ app.post("/kafka-bridge/api/v0/event", async (req, res) => {

try {
producer.produce(topic, null, Buffer.from(JSON.stringify(payload)))
flushProducer(1000)
flushProducer(1000).catch((err) => {
logger.warn(new KafkaError("Flushing the producer failed", err))
return res.status(500).json({ error: err.toString() }).send()
})
} catch (e: any) {
logger.error(new KafkaError("Producing to kafka failed", e))
return res.status(500).json({ error: e.toString() }).send()
Expand Down

0 comments on commit 8bdb5ad

Please sign in to comment.