Skip to content

Commit

Permalink
index writing only once during DynamoModel initialization (#14447)
Browse files Browse the repository at this point in the history
  • Loading branch information
QilongTang authored Sep 29, 2023
1 parent d6ee1a2 commit c12d585
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/DynamoCore/Models/DynamoModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,8 @@ protected DynamoModel(IStartConfiguration config)
State = DynamoModelState.StartedUIless;
// This event should only be raised at the end of this method.
DynamoReady(new ReadyParams(this));
// Write index to disk only once
LuceneUtility.CommitWriterChanges();
}

/// <summary>
Expand Down Expand Up @@ -1496,8 +1498,6 @@ private void InitializeCustomNodeManager()
AddNodeTypeToSearchIndex(searchElement, iDoc);
}
LuceneUtility.CommitWriterChanges();
Action<CustomNodeInfo> infoUpdatedHandler = null;
infoUpdatedHandler = newInfo =>
{
Expand Down Expand Up @@ -1689,12 +1689,6 @@ private void InitializeNodeLibrary()
}

CustomNodeManager.AddUninitializedCustomNodesInPath(pathManager.CommonDefinitions, IsTestMode);

// Initialize searcher, if the applyAllDeletes is true all buffered deletes on documents will be applied (made visible) in the returned reader
// When running parallel tests several are trying to write in the AppData folder then the job
// is failing and in a wrong state so we prevent to initialize Lucene index writer during test mode.
// Without the index files on disk, the dirReader cant be initialized correctly. So does the searcher.
LuceneUtility.CommitWriterChanges();
}

/// <summary>
Expand Down

0 comments on commit c12d585

Please sign in to comment.