+ Add progress every 100 files

This commit is contained in:
Michaël Van Canneyt 2024-09-27 15:49:16 +02:00
parent f1abd077e5
commit ce1a3e5b62
4 changed files with 22 additions and 5 deletions

View File

@ -235,6 +235,8 @@ Type
TInstantSearchIndexTreeThread = class(TInstantSearchIndexThread)
private
FTrees : TSourceTreeDefinitionList;
FCurrentTree : string;
FProcessedCount : Integer;
procedure DoCheckTerminate(Sender: TObject; const aFileName: String; var aContinue: Boolean);
function IndexTree(aTree: TSourceTreeDefinition): Integer;
Public
@ -400,6 +402,9 @@ end;
procedure TInstantSearchIndexTreeThread.DoCheckTerminate(Sender: TObject;
const aFileName: String; var aContinue: Boolean);
begin
inc(FProcessedCount);
if (FProcessedCount mod 100)=0 then
DoLog(mlkProgress,lrsIndexingTreeFileCount,[FCurrentTree,FProcessedCount]);
if Terminated then
aContinue:=False;
end;
@ -410,20 +415,21 @@ procedure TInstantSearchIndexTreeThread.Execute;
var
I,aCount : Integer;
aTree : TSourceTreeDefinition;
aName : string;
begin
For I:=0 to FTrees.Count-1 do
try
FProcessedCount:=0;
aTree:=FTrees[i];
aName:=aTree.Name;
DoLog(mlkProgress,lrsStartIndexingTree,[aName,aTree.BaseDir]);
FCurrentTree:=aTree.Name;
DoLog(mlkProgress,lrsStartIndexingTree,[FCurrentTree,aTree.BaseDir]);
aCount:=IndexTree(aTree);
DoLog(mlkProgress,lrsFinishedIndexingTree,[aName,aCount]);
DoLog(mlkProgress,lrsFinishedIndexingTree,[FCurrentTree,aCount]);
if Terminated then
Break;
except
On E : exception do
DoLog(mlkError,'Exception %s while indexing tree %s : %s',[E.ClassName,aName,E.Message]);
DoLog(mlkError,'Exception %s while indexing tree %s : %s',[E.ClassName,FCurrentTree,E.Message]);
end;
end;

View File

@ -109,6 +109,7 @@ Resourcestring
lrsCannotIndexIndexInProgress = 'Cannot start an index operation while another one is in progress.';
lrsFinishedIndexingTree = 'Finished indexing tree "%s". Processed %d files.';
lrsStartIndexingTree = 'Start indexing tree "%s", directory: "%s"';
lrsIndexingTreeFileCount = 'Tree "%s", indexed file count: %d';
lrsFinishedIndexingProject = 'Finished indexing project "%s". Processed %d files.';
lrsIndexingProjectTerminated = 'Indexing project "%s" was terminated. Processed %d files.';
lrsStartIndexingProject = 'Start indexing project "%s", directory: "%s"';

View File

@ -195,6 +195,11 @@ msgstr ""
msgid "Indexing project \"%s\" was terminated. Processed %d files."
msgstr ""
#: instantsearchstrings.lrsindexingtreefilecount
#, object-pascal-format
msgid "Tree \"%s\", indexed file count: %d"
msgstr ""
#: instantsearchstrings.lrsindexlater
msgid "No, do not index now"
msgstr ""

View File

@ -219,6 +219,11 @@ msgstr "Индексирование и поиск"
msgid "Indexing project \"%s\" was terminated. Processed %d files."
msgstr "Индексирование проекта \"%s\" прервано. Обработано файлов: %d."
#: instantsearchstrings.lrsindexingtreefilecount
#, object-pascal-format
msgid "Tree \"%s\", indexed file count: %d"
msgstr ""
#: instantsearchstrings.lrsindexlater
msgid "No, do not index now"
msgstr "Нет, не индексировать сейчас"