shell: limit taos_history file size and rows

This commit is contained in:
afwerar 2022-07-18 20:30:28 +08:00
parent 1e4dae929c
commit 912652c2e6
1 changed files with 0 additions and 2 deletions

View File

@ -766,12 +766,10 @@ void shellReadHistory() {
endIndex = pHistory->hend;
}
for (int32_t i = (pHistory->hend + SHELL_MAX_HISTORY_SIZE - 1) % SHELL_MAX_HISTORY_SIZE; i != endIndex;) {
printf("%d ",i);
taosFprintfFile(pFile, "%s\n", pHistory->hist[i]);
i = (i + SHELL_MAX_HISTORY_SIZE - 1) % SHELL_MAX_HISTORY_SIZE;
}
taosFprintfFile(pFile, "%s\n", pHistory->hist[endIndex]);
printf("\n");
taosFsyncFile(pFile);
taosCloseFile(&pFile);
}