async
parent
ef258f05ad
commit
5db7b20e9f
Binary file not shown.
|
@ -139,7 +139,7 @@ class ArticleRepository:
|
|||
|
||||
async def fetch_article(self, url: str) -> tuple[str, str]:
|
||||
async with self._lock:
|
||||
result = await self.get_article(url)
|
||||
result = self._get_article(url)
|
||||
if result:
|
||||
return result
|
||||
|
||||
|
@ -165,6 +165,9 @@ class ArticleRepository:
|
|||
|
||||
async def get_article(self, url: str) -> tuple[str, str] | None:
|
||||
async with self._lock:
|
||||
return self._get_article(url)
|
||||
|
||||
def _get_article(self, url: str) -> tuple[str, str] | None:
|
||||
# Single writer at a time when using sqlite3 – avoids `database is locked`
|
||||
row = self._row_for_url(url)
|
||||
|
||||
|
|
Loading…
Reference in New Issue