Skip to content

NodeJS doesn't exit after connection is closed #278

Description

@chrischen

I am using this version: "express-cassandra@npm:2.9.1"

Sorry excuse the ReScript syntax:

let cassandraClient = await initializeCassandraClient()

// This calls syncDB and waits for sync to complete for all 3 tables before proceeding
  let (
    _messageByTopicModel,
    _globalMessageCursorModel,
    _messageProcessingQueueModel,
  ) = await initializeMessageModels(cassandraClient)
  Js.log("🔄 Processing unprocessed Cassandra messages...")
  await processUnprocessedCassandraMessages(cassandraClient, get_rsvps)
  Js.log("✅ Done processing messages")

// I tried doing a setTimeout just in case, but it still hangs after calling close
  // Wait 3 seconds before shutdown to allow pending operations to complete
  Js.log("⏳ Waiting 3 seconds before shutdown...")
  await Promise.make((resolve, _reject) => {
    let _ = setTimeout(() => resolve(), 3000)
  })

  // Gracefully shutdown the Cassandra connection
  Js.log("🔄 Shutting down Cassandra connection...")
  await cassandraClient->ExpressCassandra.closeAsync

  Js.log("✅ Cassandra connection gracefully closed")
// From here it hangs and never quits
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions