mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-10-20 23:08:14 +00:00
Fix: Missing call to tanvity wait_merging_threads (#12863)
This commit is contained in:
1 parent
525b986e23
commit
4a8d79be6f
1 file changed
+7
@@ -220,6 +220,10 @@ class WriteBatch:
|
|||||||
try:
|
try:
|
||||||
if exc_type is None:
|
if exc_type is None:
|
||||||
self._writer.commit()
|
self._writer.commit()
|
||||||
|
# Wait for background merge threads to finish before releasing
|
||||||
|
# the file lock so the next writer doesn't race against an
|
||||||
|
# in-progress merge on the same index files.
|
||||||
|
self._writer.wait_merging_threads()
|
||||||
self._backend._index.reload()
|
self._backend._index.reload()
|
||||||
# Explicitly delete writer to release tantivy's internal lock.
|
# Explicitly delete writer to release tantivy's internal lock.
|
||||||
# On exception the uncommitted writer is simply discarded.
|
# On exception the uncommitted writer is simply discarded.
|
||||||
@@ -922,6 +926,9 @@ class TantivyBackend:
|
|||||||
)
|
)
|
||||||
writer.add_document(doc)
|
writer.add_document(doc)
|
||||||
writer.commit()
|
writer.commit()
|
||||||
|
# Wait for background merge threads to finish so all segments are
|
||||||
|
# fully merged and persisted before the index is considered rebuilt.
|
||||||
|
writer.wait_merging_threads()
|
||||||
new_index.reload()
|
new_index.reload()
|
||||||
except BaseException: # pragma: no cover
|
except BaseException: # pragma: no cover
|
||||||
# Restore old index on failure so the backend remains usable
|
# Restore old index on failure so the backend remains usable
|
||||||
|
|||||||
Reference in new issue
Block a user