From 0855d87e0979bbe90c169a952dd5a0ff93f9b400 Mon Sep 17 00:00:00 2001 From: "bodong.yang" Date: Thu, 12 Dec 2024 07:37:48 +0000 Subject: [PATCH] minor fix --- src/ota_metadata/file_table/_orm.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/ota_metadata/file_table/_orm.py b/src/ota_metadata/file_table/_orm.py index ae7053d47..d684adc3a 100644 --- a/src/ota_metadata/file_table/_orm.py +++ b/src/ota_metadata/file_table/_orm.py @@ -66,11 +66,14 @@ def check_entry(self, **kv: Any) -> bool: where_cols=tuple(kv), ) - with self._con as conn: - _cur = conn.execute(_sql_stmt, kv) - _cur.row_factory = None - _res: tuple[int] = _cur.fetchone() - return _res[0] > 0 + def _inner(): + with self._con as conn: + _cur = conn.execute(_sql_stmt, kv) + _cur.row_factory = None + _res: tuple[int] = _cur.fetchone() + return _res[0] > 0 + + return self._pool.submit(_inner).result() class FileTableNonRegularFilesORM(ORMBase[FileTableNonRegularFiles]):