fixed unload pdf backend resources (#129)
Signed-off-by: faisal shah <fashah@redhat.com> Co-authored-by: faisal shah <fashah@redhat.com>
This commit is contained in:
parent
9b82ae3324
commit
d412c363d7
@ -199,9 +199,6 @@ class DocumentConverter:
|
|||||||
end_pb_time = time.time() - start_pb_time
|
end_pb_time = time.time() - start_pb_time
|
||||||
_log.info(f"Finished converting page batch time={end_pb_time:.3f}")
|
_log.info(f"Finished converting page batch time={end_pb_time:.3f}")
|
||||||
|
|
||||||
# Free up mem resources of PDF backend
|
|
||||||
in_doc._backend.unload()
|
|
||||||
|
|
||||||
conv_res.pages = all_assembled_pages
|
conv_res.pages = all_assembled_pages
|
||||||
self._assemble_doc(conv_res)
|
self._assemble_doc(conv_res)
|
||||||
|
|
||||||
@ -227,6 +224,11 @@ class DocumentConverter:
|
|||||||
f"{trace}"
|
f"{trace}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
finally:
|
||||||
|
# Always unload the PDF backend, even in case of failure
|
||||||
|
if in_doc._backend:
|
||||||
|
in_doc._backend.unload()
|
||||||
|
|
||||||
end_doc_time = time.time() - start_doc_time
|
end_doc_time = time.time() - start_doc_time
|
||||||
_log.info(
|
_log.info(
|
||||||
f"Finished converting document time-pages={end_doc_time:.2f}/{in_doc.page_count}"
|
f"Finished converting document time-pages={end_doc_time:.2f}/{in_doc.page_count}"
|
||||||
|
Loading…
Reference in New Issue
Block a user