From 2aa6c66612520c29f50538a27bc1b2776f8f5abc Mon Sep 17 00:00:00 2001 From: fang Date: Fri, 16 Aug 2019 17:59:41 +0800 Subject: [PATCH] repeat insertation if failed, report failure when inserting 5 times --- src/kit/taosdemo/taosdemo.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/kit/taosdemo/taosdemo.c b/src/kit/taosdemo/taosdemo.c index ad6d9df995..c929c81eaa 100644 --- a/src/kit/taosdemo/taosdemo.c +++ b/src/kit/taosdemo/taosdemo.c @@ -660,7 +660,12 @@ void *readMetric(void *sarg) { } void queryDB(TAOS *taos, char *command) { - if (taos_query(taos, command) != 0) { + int i = 5; + while (i > 0) { + if (taos_query(taos, command) == 0) break; + i--; + } + if (i == 0) { fprintf(stderr, "Failed to run %s, reason: %s\n", command, taos_errstr(taos)); taos_close(taos); exit(EXIT_FAILURE); -- GitLab