async function tableCreated()

in nodejs/datastax-v4/ecs-sigv4/app/load-data/load-data.js [28:40]


async function tableCreated(keyspace, table) {
  const query = `SELECT status
    FROM system_schema_mcs.tables
    WHERE keyspace_name='${keyspace}' AND table_name='${table}'`
  let status = 'CREATING';
  do {
    const result = await cassandraClient.execute(query)
    const firstRow = result.first()
    if (firstRow) status = firstRow['status']
    log.info(`${keyspace}.${table} status: ${status}`)
    if (status !== 'ACTIVE') await new Promise(r => setTimeout(r, 1000)); // Wait 1 sec and try again
  } while (status!=='ACTIVE')
}