Skip to content

Commit

Permalink
fix: add clean exit with code 1 for Kafka producer error
Browse files Browse the repository at this point in the history
Fixes issue #9
  • Loading branch information
sydrawat01 authored and karanwadhwa committed Nov 20, 2023
1 parent 4e18743 commit 25b4cbf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,12 @@ BROKER_1=
BROKER_2=
CLIENT_ID=
TOPIC=
NAME=
URL=
IS_PAUSED=
NUM_RETRIES=
UPTIME_SLA=
RESPONSE_TIME_SLA=
USE_SSL=
RESPONSE_STATUS_CODE=
CHECK_INTERVAL_IN_SECONDS=
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ const init = async () => {
],
})
logger.info(`Message sent`, { msg: data, res: result })
await producer.disconnect()
await producer.disconnect() // performs clean exit
} catch (error) {
logger.error(`Kafka producer error`, { error })
process.exit(1)
}
}

Expand Down

0 comments on commit 25b4cbf

Please sign in to comment.