merge conflict: fix(db): use RLock instead of Lock

This commit is contained in:
psychedelicious 2023-10-16 13:20:05 +11:00
parent 43266b18c7
commit 5f35ad078d
6 changed files with 11 additions and 11 deletions

View File

@ -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!)

View File

@ -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!)

View File

@ -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!)

View File

@ -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!)

View File

@ -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

View File

@ -1,3 +1,3 @@
import threading
lock = threading.Lock()
lock = threading.RLock()