Skip to content

Commit

Permalink
minor update
Browse files Browse the repository at this point in the history
  • Loading branch information
Bodong-Yang committed Dec 12, 2024
1 parent 743f9b0 commit 34f2130
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/ota_metadata/file_table/_orm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down
11 changes: 5 additions & 6 deletions src/otaclient/create_standby/_delta_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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()

0 comments on commit 34f2130

Please sign in to comment.