]> git.ipfire.org Git - pbs.git/commitdiff
packages: Extract filelists in a separate thread
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 17 Aug 2023 10:17:34 +0000 (10:17 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 17 Aug 2023 10:17:34 +0000 (10:17 +0000)
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 <michael.tremer@ipfire.org>
src/buildservice/packages.py

index 9da16e0f03bd3fcaa33e4ed6cc83839905d77651..aabded80120b37ac9ccf60d1e3ea611ecfb31284 100644 (file)
@@ -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