arpakitlib 1.8.269__py3-none-any.whl → 1.8.270__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.
@@ -26,6 +26,7 @@ class BaseWorker(ABC):
26
26
  startup_funcs: list[Any] | None = None,
27
27
  worker_name: str | None = None,
28
28
  data: dict[str, Any] | None = None,
29
+ timeout_before_safe_run: timedelta | None= None,
29
30
  **kwargs
30
31
  ):
31
32
  self.timeout_after_run = timeout_after_run
@@ -44,6 +45,8 @@ class BaseWorker(ABC):
44
45
  data = {}
45
46
  self.data = data
46
47
 
48
+ self.timeout_before_safe_run = timeout_before_safe_run
49
+
47
50
  self._logger = logging.getLogger(self.worker_fullname)
48
51
 
49
52
  @property
@@ -75,10 +78,10 @@ class BaseWorker(ABC):
75
78
  def sync_on_error(self, exception: Exception, **kwargs):
76
79
  pass
77
80
 
78
- def sync_safe_run(self, *, timeout_before_run: timedelta | None = None):
81
+ def sync_safe_run(self):
79
82
  self._logger.info("start")
80
- if timeout_before_run is not None:
81
- sync_safe_sleep(timeout_before_run)
83
+ if self.timeout_before_safe_run is not None:
84
+ sync_safe_sleep(self.timeout_before_safe_run)
82
85
  try:
83
86
  self.sync_on_startup()
84
87
  except Exception as exception:
@@ -119,10 +122,10 @@ class BaseWorker(ABC):
119
122
  async def async_on_error(self, exception: Exception, **kwargs):
120
123
  pass
121
124
 
122
- async def async_safe_run(self, *, timeout_before_run: timedelta | None = None):
125
+ async def async_safe_run(self):
123
126
  self._logger.info("start async_safe_run")
124
- if timeout_before_run is not None:
125
- await async_safe_sleep(timeout_before_run)
127
+ if self.timeout_before_safe_run is not None:
128
+ await async_safe_sleep(self.timeout_before_safe_run)
126
129
  try:
127
130
  await self.async_on_startup()
128
131
  except Exception as exception:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: arpakitlib
3
- Version: 1.8.269
3
+ Version: 1.8.270
4
4
  Summary: arpakitlib
5
5
  License: Apache-2.0
6
6
  Keywords: arpakitlib,arpakit,arpakit-company,arpakitcompany,arpakit_company
@@ -384,7 +384,7 @@ arpakitlib/ar_arpakit_schedule_uust_api_client_util.py,sha256=MRPaF31CRhYA45ldPn
384
384
  arpakitlib/ar_arpakit_schedule_uust_site_util.py,sha256=8wLct9Gd4MWkXzB6nSmETAwTPLw8lfpWgx0LoWSAOvg,1643
385
385
  arpakitlib/ar_arpakitlib_cli_util.py,sha256=RJGcfEZ_q74FJ4tqdXvt7xQpShTszOvKu1mbp3D8qzw,2599
386
386
  arpakitlib/ar_base64_util.py,sha256=udSSpeXMZx0JgQknl4hQgZ8kr1Ps_aQOloIXu4T9dMQ,1286
387
- arpakitlib/ar_base_worker_util.py,sha256=QXrk_bnxgxtbmz8YhfShxuLMMJEz2HK2KZpYeFcRm1I,6267
387
+ arpakitlib/ar_base_worker_util.py,sha256=4XN29vkju1OBmvZj1MVjxGXVWQzcs9Sdd90JBj1QoFg,6336
388
388
  arpakitlib/ar_blank_util.py,sha256=qFUdY8usL_pRYamz8Rw1fW3fzNIgrLmpdYP8q-_PQvw,2281
389
389
  arpakitlib/ar_cache_file_util.py,sha256=Fo2pH-Zqm966KWFBHG_pbiySGZvhIFCYqy7k1weRfJ0,3476
390
390
  arpakitlib/ar_class_util.py,sha256=i76pQW_7k_S2m_DlQh6xNjtggv9Col3WSx9W_bwk98E,722
@@ -431,8 +431,8 @@ arpakitlib/ar_sqlalchemy_util.py,sha256=EMMaoVerrDaFXCCwH2BbbpaVr_oKp4nDlbnoJRJg
431
431
  arpakitlib/ar_str_util.py,sha256=2lGpnXDf2h1cBZpVf5i1tX_HCv5iBd6IGnrCw4QWWlY,4350
432
432
  arpakitlib/ar_type_util.py,sha256=Cs_tef-Fc5xeyAF54KgISCsP11NHyzIsglm4S3Xx7iM,4049
433
433
  arpakitlib/ar_yookassa_api_client_util.py,sha256=VozuZeCJjmLd1zj2BdC9WfiAQ3XYOrIMsdpNK-AUlm0,5347
434
- arpakitlib-1.8.269.dist-info/LICENSE,sha256=GPEDQMam2r7FSTYqM1mm7aKnxLaWcBotH7UvQtea-ec,11355
435
- arpakitlib-1.8.269.dist-info/METADATA,sha256=bA31Hw4OoYrLzkLSB8hVlkHmS77vA_TS00PKwkJe28g,3919
436
- arpakitlib-1.8.269.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
437
- arpakitlib-1.8.269.dist-info/entry_points.txt,sha256=36xqR3PJFT2kuwjkM_EqoIy0qFUDPKSm_mJaI7emewE,87
438
- arpakitlib-1.8.269.dist-info/RECORD,,
434
+ arpakitlib-1.8.270.dist-info/LICENSE,sha256=GPEDQMam2r7FSTYqM1mm7aKnxLaWcBotH7UvQtea-ec,11355
435
+ arpakitlib-1.8.270.dist-info/METADATA,sha256=sACtJcmW742VoZKW6EFTHaKvD33JVKgyA_N5JfCoq8Y,3919
436
+ arpakitlib-1.8.270.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
437
+ arpakitlib-1.8.270.dist-info/entry_points.txt,sha256=36xqR3PJFT2kuwjkM_EqoIy0qFUDPKSm_mJaI7emewE,87
438
+ arpakitlib-1.8.270.dist-info/RECORD,,