module: file_manager

Allow default metadata parser timeout to be configurable

Signed-off-by: Paul Morgan moggieuk@hotmail.com
This commit is contained in:
Moggie 2024-06-09 09:35:44 +07:00 committed by Eric Callahan
parent 346a3d7c9d
commit 4d6037c3d3
1 changed files with 5 additions and 3 deletions

View File

@ -2280,6 +2280,8 @@ class MetadataStorage:
self.server = config.get_server()
self.enable_object_proc = config.getboolean(
'enable_object_processing', False)
self.default_metadata_parser_timeout = config.getfloat(
'default_metadata_parser_timeout', 20.)
self.gc_path = ""
db.register_local_namespace(METADATA_NAMESPACE)
self.mddb = db.wrap_namespace(
@ -2545,13 +2547,13 @@ class MetadataStorage:
filename = filename.replace("\"", "\\\"")
cmd = " ".join([sys.executable, METADATA_SCRIPT, "-p",
self.gc_path, "-f", f"\"{filename}\""])
timeout = 10.
timeout = self.default_metadata_parser_timeout
if ufp_path is not None and os.path.isfile(ufp_path):
timeout = 300.
timeout = max(timeout, 300.)
ufp_path.replace("\"", "\\\"")
cmd += f" -u \"{ufp_path}\""
if self.enable_object_proc:
timeout = 300.
timeout = max(timeout, 300.)
cmd += " --check-objects"
result = bytearray()
sc: SCMDComp = self.server.lookup_component('shell_command')