mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-11-27 08:45:07 -05:00
Lock scanner processing to a single runner
This commit is contained in:
parent
5bc6a06b91
commit
05f7fabb3c
@ -55,6 +55,7 @@ class RequestProcessor:
|
|||||||
self._database: Connection = None # type: ignore
|
self._database: Connection = None # type: ignore
|
||||||
self._client = client
|
self._client = client
|
||||||
self._providers = providers
|
self._providers = providers
|
||||||
|
self._processing = False
|
||||||
|
|
||||||
@tracer.start_as_current_span("listen_requests")
|
@tracer.start_as_current_span("listen_requests")
|
||||||
async def listen(self, tg: TaskGroup):
|
async def listen(self, tg: TaskGroup):
|
||||||
@ -85,6 +86,10 @@ class RequestProcessor:
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
async def process_all(self):
|
async def process_all(self):
|
||||||
|
if self._processing:
|
||||||
|
return
|
||||||
|
self._processing = True
|
||||||
|
try:
|
||||||
found = True
|
found = True
|
||||||
while found:
|
while found:
|
||||||
try:
|
try:
|
||||||
@ -93,6 +98,8 @@ class RequestProcessor:
|
|||||||
logger.error(
|
logger.error(
|
||||||
"Failed to process one of the metadata request", exc_info=e
|
"Failed to process one of the metadata request", exc_info=e
|
||||||
)
|
)
|
||||||
|
finally:
|
||||||
|
self._processing = False
|
||||||
|
|
||||||
async def process_request(self):
|
async def process_request(self):
|
||||||
cur = await self._database.fetchrow(
|
cur = await self._database.fetchrow(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user