From 34f21302d1d9f47ecb56ea95178c7297f6802ea6 Mon Sep 17 00:00:00 2001 From: "bodong.yang" Date: Thu, 12 Dec 2024 07:33:14 +0000 Subject: [PATCH] minor update --- src/ota_metadata/file_table/_orm.py | 4 ++-- src/otaclient/create_standby/_delta_gen.py | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/ota_metadata/file_table/_orm.py b/src/ota_metadata/file_table/_orm.py index a4924f96c..ae7053d47 100644 --- a/src/ota_metadata/file_table/_orm.py +++ b/src/ota_metadata/file_table/_orm.py @@ -57,7 +57,7 @@ def __init__( thread_name_prefix=thread_name_prefix, ) - def check_entry(self, **kv: dict[str, Any]) -> bool: + def check_entry(self, **kv: Any) -> bool: """A quick method to check if an entry exists.""" _sql_stmt = self.orm_table_spec.table_select_stmt( select_from=self.orm_table_name, @@ -67,7 +67,7 @@ def check_entry(self, **kv: dict[str, Any]) -> bool: ) with self._con as conn: - _cur = conn.execute(_sql_stmt) + _cur = conn.execute(_sql_stmt, kv) _cur.row_factory = None _res: tuple[int] = _cur.fetchone() return _res[0] > 0 diff --git a/src/otaclient/create_standby/_delta_gen.py b/src/otaclient/create_standby/_delta_gen.py index 64d0019eb..3ae7e89ff 100644 --- a/src/otaclient/create_standby/_delta_gen.py +++ b/src/otaclient/create_standby/_delta_gen.py @@ -113,12 +113,10 @@ def _process_file( thread_local, ) -> None: # in default match_only mode, if the fpath doesn't exist in new, ignore - if not fully_scan: - _lookup_res = self._ft_regular_orm.orm_select_entries( - path=str(canonical_fpath) - ).result() - if not _lookup_res: - return + if not fully_scan and not self._ft_regular_orm.check_entry( + path=str(canonical_fpath) + ): + return tmp_f = self._copy_dst / create_tmp_fname() @@ -257,4 +255,5 @@ def calculate_delta(self) -> None: finally: pool.shutdown(wait=True) self._ft_regular_orm.orm_pool_shutdown() + self._ft_non_regular_orm.orm_con.close() self._rst_orm_pool.orm_pool_shutdown()