lacuscore 1.14.2__py3-none-any.whl → 1.14.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
lacuscore/lacuscore.py CHANGED
@@ -19,7 +19,7 @@ from datetime import date, timedelta
19
19
  from ipaddress import ip_address, IPv4Address, IPv6Address
20
20
  from tempfile import NamedTemporaryFile
21
21
  from typing import Literal, Any, overload, cast, TYPE_CHECKING
22
- from collections.abc import Iterator
22
+ from collections.abc import AsyncIterator
23
23
  from uuid import uuid4
24
24
  from urllib.parse import urlsplit
25
25
 
@@ -358,7 +358,7 @@ class LacusCore():
358
358
  return CaptureStatus.DONE
359
359
  return CaptureStatus.UNKNOWN
360
360
 
361
- def consume_queue(self, max_consume: int) -> Iterator[Task]: # type: ignore[type-arg]
361
+ async def consume_queue(self, max_consume: int) -> AsyncIterator[Task[None]]:
362
362
  """Trigger the capture for captures with the highest priority. Up to max_consume.
363
363
 
364
364
  :yield: Captures.
@@ -378,6 +378,8 @@ class LacusCore():
378
378
  yield task_logger.create_task(self._capture(uuid, priority), name=uuid,
379
379
  logger=logger,
380
380
  message='Capture raised an uncaught exception')
381
+ # Make sur the task starts.
382
+ await asyncio.sleep(0.5)
381
383
 
382
384
  async def _capture(self, uuid: str, priority: int) -> None:
383
385
  """Trigger a specific capture
@@ -643,8 +645,12 @@ class LacusCore():
643
645
  # If the capture fails to be stored in valkey, we must also remove the capture settings
644
646
  # so it is not dangling there.
645
647
 
646
- if to_capture.document:
647
- os.unlink(tmp_f.name)
648
+ try:
649
+ if to_capture.document:
650
+ os.unlink(tmp_f.name)
651
+ except UnboundLocalError:
652
+ # Missing settings, the capture failed.
653
+ pass
648
654
 
649
655
  if retry:
650
656
  if self.redis.zcard('lacus:to_capture') == 0:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: lacuscore
3
- Version: 1.14.2
3
+ Version: 1.14.3
4
4
  Summary: Core of Lacus, usable as a module
5
5
  License: BSD-3-Clause
6
6
  Author: Raphaël Vinot
@@ -1,10 +1,10 @@
1
1
  lacuscore/__init__.py,sha256=aLBshQPT9IBDKn5qWrX9A_exqtLFPyLsQiPWdfpAFjA,537
2
2
  lacuscore/helpers.py,sha256=d1rMHEA9A9NwfKksa2JvhLu-egaCBf1Vs2F7ALtAhmo,14264
3
3
  lacuscore/lacus_monitoring.py,sha256=r6IaYuh6sMq43eOWdZx0fU8p4PWVZlqSD6nr6yOaTUU,2713
4
- lacuscore/lacuscore.py,sha256=zUkfSSn9_tFE9vnFo309obHJdvBBfhVjwe7IDL7csoU,44492
4
+ lacuscore/lacuscore.py,sha256=5JeM2XyMUZJWMIWul1j3GGKmzH8lUZubXkL-ec56rtk,44705
5
5
  lacuscore/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  lacuscore/task_logger.py,sha256=2wDotU6r6vn-aKO8nZNdxSuisSj11LlcxuvW60qPL0Y,1909
7
- lacuscore-1.14.2.dist-info/LICENSE,sha256=4C4hLYrIkUD96Ggk-y_Go1Qf7PBZrEm9PSeTGe2nd4s,1516
8
- lacuscore-1.14.2.dist-info/METADATA,sha256=qkvp08WeFCrDYogV4NcoFFvGGlgvWZC3P6-RwkgtBJ0,2654
9
- lacuscore-1.14.2.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
10
- lacuscore-1.14.2.dist-info/RECORD,,
7
+ lacuscore-1.14.3.dist-info/LICENSE,sha256=4C4hLYrIkUD96Ggk-y_Go1Qf7PBZrEm9PSeTGe2nd4s,1516
8
+ lacuscore-1.14.3.dist-info/METADATA,sha256=BGqoy4gu2jancStlS3jBqfyjnVq9Z7APMmSRkKJzZV0,2654
9
+ lacuscore-1.14.3.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
10
+ lacuscore-1.14.3.dist-info/RECORD,,