repeat insertation if failed, report failure when inserting 5 times

This commit is contained in:
fang 2019-08-16 17:59:41 +08:00
parent c9ebc4e33e
commit 2aa6c66612
1 changed files with 6 additions and 1 deletions

View File

@ -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);