Skip to content

Commit 5f35ad0

Browse files
merge conflict: fix(db): use RLock instead of Lock
1 parent 43266b1 commit 5f35ad0

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

invokeai/app/services/board_image_record_storage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ def get_image_count_for_board(
5555
class SqliteBoardImageRecordStorage(BoardImageRecordStorageBase):
5656
_conn: sqlite3.Connection
5757
_cursor: sqlite3.Cursor
58-
_lock: threading.Lock
58+
_lock: threading.RLock
5959

60-
def __init__(self, conn: sqlite3.Connection, lock: threading.Lock) -> None:
60+
def __init__(self, conn: sqlite3.Connection, lock: threading.RLock) -> None:
6161
super().__init__()
6262
self._conn = conn
6363
# Enable row factory to get rows as dictionaries (must be done before making the cursor!)

invokeai/app/services/board_record_storage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ def get_all(
8989
class SqliteBoardRecordStorage(BoardRecordStorageBase):
9090
_conn: sqlite3.Connection
9191
_cursor: sqlite3.Cursor
92-
_lock: threading.Lock
92+
_lock: threading.RLock
9393

94-
def __init__(self, conn: sqlite3.Connection, lock: threading.Lock) -> None:
94+
def __init__(self, conn: sqlite3.Connection, lock: threading.RLock) -> None:
9595
super().__init__()
9696
self._conn = conn
9797
# Enable row factory to get rows as dictionaries (must be done before making the cursor!)

invokeai/app/services/image_record_storage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@ def get_most_recent_image_for_board(self, board_id: str) -> Optional[ImageRecord
150150
class SqliteImageRecordStorage(ImageRecordStorageBase):
151151
_conn: sqlite3.Connection
152152
_cursor: sqlite3.Cursor
153-
_lock: threading.Lock
153+
_lock: threading.RLock
154154

155-
def __init__(self, conn: sqlite3.Connection, lock: threading.Lock) -> None:
155+
def __init__(self, conn: sqlite3.Connection, lock: threading.RLock) -> None:
156156
super().__init__()
157157
self._conn = conn
158158
# Enable row factory to get rows as dictionaries (must be done before making the cursor!)

invokeai/app/services/session_queue/session_queue_sqlite.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class SqliteSessionQueue(SessionQueueBase):
3636
__invoker: Invoker
3737
__conn: sqlite3.Connection
3838
__cursor: sqlite3.Cursor
39-
__lock: threading.Lock
39+
__lock: threading.RLock
4040

4141
def start(self, invoker: Invoker) -> None:
4242
self.__invoker = invoker
@@ -45,7 +45,7 @@ def start(self, invoker: Invoker) -> None:
4545
local_handler.register(event_name=EventServiceBase.queue_event, _func=self._on_session_event)
4646
self.__invoker.services.logger.info(f"Pruned {prune_result.deleted} finished queue items")
4747

48-
def __init__(self, conn: sqlite3.Connection, lock: threading.Lock) -> None:
48+
def __init__(self, conn: sqlite3.Connection, lock: threading.RLock) -> None:
4949
super().__init__()
5050
self.__conn = conn
5151
# Enable row factory to get rows as dictionaries (must be done before making the cursor!)

invokeai/app/services/sqlite.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ class SqliteItemStorage(ItemStorageABC, Generic[T]):
1616
_conn: sqlite3.Connection
1717
_cursor: sqlite3.Cursor
1818
_id_field: str
19-
_lock: threading.Lock
19+
_lock: threading.RLock
2020

21-
def __init__(self, conn: sqlite3.Connection, table_name: str, lock: threading.Lock, id_field: str = "id"):
21+
def __init__(self, conn: sqlite3.Connection, table_name: str, lock: threading.RLock, id_field: str = "id"):
2222
super().__init__()
2323

2424
self._table_name = table_name

invokeai/app/services/thread.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
import threading
22

3-
lock = threading.Lock()
3+
lock = threading.RLock()

0 commit comments

Comments
 (0)