fix node.js example error (#30287)
* test: node example case * fix: node.js example error * fix: restore test case validation
This commit is contained in:
parent
eaf87a5adb
commit
b46d79a36c
|
@ -1,4 +1,3 @@
|
||||||
const { sleep } = require("@tdengine/websocket");
|
|
||||||
const taos = require("@tdengine/websocket");
|
const taos = require("@tdengine/websocket");
|
||||||
|
|
||||||
// ANCHOR: create_consumer
|
// ANCHOR: create_consumer
|
||||||
|
@ -52,6 +51,12 @@ async function prepare() {
|
||||||
await wsSql.close();
|
await wsSql.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const delay = function(ms) {
|
||||||
|
return new Promise(function(resolve) {
|
||||||
|
setTimeout(resolve, ms);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
async function insert() {
|
async function insert() {
|
||||||
let conf = new taos.WSConfig('ws://localhost:6041');
|
let conf = new taos.WSConfig('ws://localhost:6041');
|
||||||
conf.setUser('root');
|
conf.setUser('root');
|
||||||
|
@ -60,7 +65,7 @@ async function insert() {
|
||||||
let wsSql = await taos.sqlConnect(conf);
|
let wsSql = await taos.sqlConnect(conf);
|
||||||
for (let i = 0; i < 50; i++) {
|
for (let i = 0; i < 50; i++) {
|
||||||
await wsSql.exec(`INSERT INTO d1001 USING ${stable} (location, groupId) TAGS ("California.SanFrancisco", 3) VALUES (NOW, ${10 + i}, ${200 + i}, ${0.32 + i})`);
|
await wsSql.exec(`INSERT INTO d1001 USING ${stable} (location, groupId) TAGS ("California.SanFrancisco", 3) VALUES (NOW, ${10 + i}, ${200 + i}, ${0.32 + i})`);
|
||||||
await sleep(100);
|
await delay(100);
|
||||||
}
|
}
|
||||||
await wsSql.close();
|
await wsSql.close();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue