From 5f35ad078d656164dbb8e64f14d62a5f4e8c6fdc Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Mon, 16 Oct 2023 13:20:05 +1100 Subject: [PATCH] merge conflict: fix(db): use RLock instead of Lock --- invokeai/app/services/board_image_record_storage.py | 4 ++-- invokeai/app/services/board_record_storage.py | 4 ++-- invokeai/app/services/image_record_storage.py | 4 ++-- invokeai/app/services/session_queue/session_queue_sqlite.py | 4 ++-- invokeai/app/services/sqlite.py | 4 ++-- invokeai/app/services/thread.py | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/invokeai/app/services/board_image_record_storage.py b/invokeai/app/services/board_image_record_storage.py index c4d06ec131..25c0c650b0 100644 --- a/invokeai/app/services/board_image_record_storage.py +++ b/invokeai/app/services/board_image_record_storage.py @@ -55,9 +55,9 @@ class BoardImageRecordStorageBase(ABC): class SqliteBoardImageRecordStorage(BoardImageRecordStorageBase): _conn: sqlite3.Connection _cursor: sqlite3.Cursor - _lock: threading.Lock + _lock: threading.RLock - def __init__(self, conn: sqlite3.Connection, lock: threading.Lock) -> None: + def __init__(self, conn: sqlite3.Connection, lock: threading.RLock) -> None: super().__init__() self._conn = conn # Enable row factory to get rows as dictionaries (must be done before making the cursor!) diff --git a/invokeai/app/services/board_record_storage.py b/invokeai/app/services/board_record_storage.py index c12a9c8eea..f9de8295b2 100644 --- a/invokeai/app/services/board_record_storage.py +++ b/invokeai/app/services/board_record_storage.py @@ -89,9 +89,9 @@ class BoardRecordStorageBase(ABC): class SqliteBoardRecordStorage(BoardRecordStorageBase): _conn: sqlite3.Connection _cursor: sqlite3.Cursor - _lock: threading.Lock + _lock: threading.RLock - def __init__(self, conn: sqlite3.Connection, lock: threading.Lock) -> None: + def __init__(self, conn: sqlite3.Connection, lock: threading.RLock) -> None: super().__init__() self._conn = conn # Enable row factory to get rows as dictionaries (must be done before making the cursor!) diff --git a/invokeai/app/services/image_record_storage.py b/invokeai/app/services/image_record_storage.py index 21afcaf0bf..b66a9a30b9 100644 --- a/invokeai/app/services/image_record_storage.py +++ b/invokeai/app/services/image_record_storage.py @@ -150,9 +150,9 @@ class ImageRecordStorageBase(ABC): class SqliteImageRecordStorage(ImageRecordStorageBase): _conn: sqlite3.Connection _cursor: sqlite3.Cursor - _lock: threading.Lock + _lock: threading.RLock - def __init__(self, conn: sqlite3.Connection, lock: threading.Lock) -> None: + def __init__(self, conn: sqlite3.Connection, lock: threading.RLock) -> None: super().__init__() self._conn = conn # Enable row factory to get rows as dictionaries (must be done before making the cursor!) diff --git a/invokeai/app/services/session_queue/session_queue_sqlite.py b/invokeai/app/services/session_queue/session_queue_sqlite.py index f995576311..0b6deff70d 100644 --- a/invokeai/app/services/session_queue/session_queue_sqlite.py +++ b/invokeai/app/services/session_queue/session_queue_sqlite.py @@ -36,7 +36,7 @@ class SqliteSessionQueue(SessionQueueBase): __invoker: Invoker __conn: sqlite3.Connection __cursor: sqlite3.Cursor - __lock: threading.Lock + __lock: threading.RLock def start(self, invoker: Invoker) -> None: self.__invoker = invoker @@ -45,7 +45,7 @@ class SqliteSessionQueue(SessionQueueBase): local_handler.register(event_name=EventServiceBase.queue_event, _func=self._on_session_event) self.__invoker.services.logger.info(f"Pruned {prune_result.deleted} finished queue items") - def __init__(self, conn: sqlite3.Connection, lock: threading.Lock) -> None: + def __init__(self, conn: sqlite3.Connection, lock: threading.RLock) -> None: super().__init__() self.__conn = conn # Enable row factory to get rows as dictionaries (must be done before making the cursor!) diff --git a/invokeai/app/services/sqlite.py b/invokeai/app/services/sqlite.py index 63f3356b3c..578a7b9e11 100644 --- a/invokeai/app/services/sqlite.py +++ b/invokeai/app/services/sqlite.py @@ -16,9 +16,9 @@ class SqliteItemStorage(ItemStorageABC, Generic[T]): _conn: sqlite3.Connection _cursor: sqlite3.Cursor _id_field: str - _lock: threading.Lock + _lock: threading.RLock - def __init__(self, conn: sqlite3.Connection, table_name: str, lock: threading.Lock, id_field: str = "id"): + def __init__(self, conn: sqlite3.Connection, table_name: str, lock: threading.RLock, id_field: str = "id"): super().__init__() self._table_name = table_name diff --git a/invokeai/app/services/thread.py b/invokeai/app/services/thread.py index 3fd88295b1..5d9ac6d49b 100644 --- a/invokeai/app/services/thread.py +++ b/invokeai/app/services/thread.py @@ -1,3 +1,3 @@ import threading -lock = threading.Lock() +lock = threading.RLock()