From: Michael Tremer Date: Thu, 17 Aug 2023 10:17:34 +0000 (+0000) Subject: packages: Extract filelists in a separate thread X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fb8bad717039ce0bbe1217b0cbab25b072ee15e2;p=pbs.git packages: Extract filelists in a separate thread Since we need to read the entire archive to extract the entire filelist with all its meta information, we need to move this into a separate thread. Signed-off-by: Michael Tremer --- diff --git a/src/buildservice/packages.py b/src/buildservice/packages.py index 9da16e0f..aabded80 100644 --- a/src/buildservice/packages.py +++ b/src/buildservice/packages.py @@ -172,7 +172,7 @@ class Packages(base.Object): ) # Import filelist - pkg._import_filelist(archive.filelist) + await pkg._import_filelist(archive) # Import package data await pkg._import_archive(archive) @@ -477,9 +477,12 @@ class Package(base.DataObject): # Store the path self._set_attribute("path", path) - def _import_filelist(self, filelist): + async def _import_filelist(self, archive): log.debug("Importing filelist for %s" % self) + # Fetch the filelist + filelist = await asyncio.to_thread(lambda a: a.filelist, archive) + self.db.executemany(""" INSERT INTO package_files