modify exec error

This commit is contained in:
menshibin 2024-08-15 13:37:06 +08:00
parent 8aca61c186
commit d9dbf95c5e
2 changed files with 4 additions and 4 deletions

View File

@ -62,7 +62,7 @@ async function subscribe(consumer) {
for (let [key, value] of res) {
console.log(`data: ${key} ${value}`);
}
consumer.commit();
await consumer.commit();
console.log("Commit offset manually successfully.");
}
} catch (err) {
@ -77,7 +77,7 @@ async function test() {
let consumer = null;
try {
await prepare();
let consumer = await createConsumer()
consumer = await createConsumer()
await subscribe(consumer)
await consumer.unsubscribe();
console.log("Consumer unsubscribed successfully.");

View File

@ -31,7 +31,7 @@ async function prepare() {
conf.setUser('root');
conf.setPwd('taosdata');
conf.setDb('power');
const createDB = `CREATE DATABASE IF NOT EXISTS POWER ${db} KEEP 3650 DURATION 10 BUFFER 16 WAL_LEVEL 1;`;
const createDB = `CREATE DATABASE IF NOT EXISTS ${db} KEEP 3650 DURATION 10 BUFFER 16 WAL_LEVEL 1;`;
const createStable = `CREATE STABLE IF NOT EXISTS ${db}.${stable} (ts timestamp, current float, voltage int, phase float) TAGS (location binary(64), groupId int);`;
let wsSql = await taos.sqlConnect(conf);
@ -45,7 +45,7 @@ async function prepare() {
for (let i = 0; i < 10; i++) {
await wsSql.exec(`INSERT INTO d1001 USING ${stable} (location, groupId) TAGS ("California.SanFrancisco", 3) VALUES (NOW, ${10 + i}, ${200 + i}, ${0.32 + i})`);
}
wsSql.Close();
await wsSql.close();
}
// ANCHOR: subscribe