Skip to content

Commit

Permalink
update heartbeat
Browse files Browse the repository at this point in the history
  • Loading branch information
Pratap2018 committed Dec 27, 2024
1 parent e2f9f8d commit 9277707
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ const checkIfPodExists = async (podName) => {
try {
const namespace = 'hypermine-development'
const res = await k8sApi.readNamespacedPod(podName, namespace);
console.log(res?.body?.status?.phase);
// console.log(res?.body?.status?.phase);
if (res?.body?.status?.phase) {

return { found: true, status: res?.body?.status?.phase }
}

} catch (error) {
console.log(error.body);
// console.log(error.body);
if (error.body.reason == 'NotFound') {
// Provison new POD
return { found: false }
Expand Down Expand Up @@ -146,7 +146,9 @@ const queueName = process.env.GLOBAL_TXN_CONTROLLER_QUEUE || 'GLOBAL_TXN_CONTROL

const namespace = 'hypermine-development'

const connection = await amqp.connect(process.env.AMQ_URL)
const connection = await amqp.connect(process.env.AMQ_URL, {
heartbeat: 30
})
const channel = await connection.createChannel();
await channel.assertQueue(queueName, {
durable: false,
Expand Down Expand Up @@ -191,6 +193,12 @@ const queueName = process.env.GLOBAL_TXN_CONTROLLER_QUEUE || 'GLOBAL_TXN_CONTROL

})

process.on('SIGINT', async () => {
console.log('Closing RabbitMQ connection...');
await channel.close();
await connection.close();
process.exit(0);
});
} catch (error) {
console.log(error.message)
}
Expand All @@ -202,3 +210,6 @@ const queueName = process.env.GLOBAL_TXN_CONTROLLER_QUEUE || 'GLOBAL_TXN_CONTROL






0 comments on commit 9277707

Please sign in to comment.