nucliadb-utils 6.2.1.post2706__py3-none-any.whl → 6.2.1.post2716__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.
Potentially problematic release.
This version of nucliadb-utils might be problematic. Click here for more details.
- nucliadb_utils/nats.py +11 -0
- nucliadb_utils/tests/nats.py +11 -0
- {nucliadb_utils-6.2.1.post2706.dist-info → nucliadb_utils-6.2.1.post2716.dist-info}/METADATA +3 -3
- {nucliadb_utils-6.2.1.post2706.dist-info → nucliadb_utils-6.2.1.post2716.dist-info}/RECORD +7 -7
- {nucliadb_utils-6.2.1.post2706.dist-info → nucliadb_utils-6.2.1.post2716.dist-info}/WHEEL +0 -0
- {nucliadb_utils-6.2.1.post2706.dist-info → nucliadb_utils-6.2.1.post2716.dist-info}/top_level.txt +0 -0
- {nucliadb_utils-6.2.1.post2706.dist-info → nucliadb_utils-6.2.1.post2716.dist-info}/zip-safe +0 -0
nucliadb_utils/nats.py
CHANGED
@@ -130,6 +130,7 @@ class NatsConnectionManager:
|
|
130
130
|
self._needs_reconnection = False
|
131
131
|
self._reconnect_task: Optional[asyncio.Task] = None
|
132
132
|
self._expected_subscriptions: set[str] = set()
|
133
|
+
self._initialized = False
|
133
134
|
|
134
135
|
def healthy(self) -> bool:
|
135
136
|
if not self._healthy:
|
@@ -147,6 +148,9 @@ class NatsConnectionManager:
|
|
147
148
|
return True
|
148
149
|
|
149
150
|
async def initialize(self) -> None:
|
151
|
+
if self._initialized:
|
152
|
+
return
|
153
|
+
|
150
154
|
options: dict[str, Any] = {
|
151
155
|
"error_cb": self.error_cb,
|
152
156
|
"closed_cb": self.closed_cb,
|
@@ -165,7 +169,12 @@ class NatsConnectionManager:
|
|
165
169
|
|
166
170
|
self._expected_subscription_task = asyncio.create_task(self._verify_expected_subscriptions())
|
167
171
|
|
172
|
+
self._initialized = True
|
173
|
+
|
168
174
|
async def finalize(self):
|
175
|
+
if not self._initialized:
|
176
|
+
return
|
177
|
+
|
169
178
|
async with self._lock:
|
170
179
|
if self._reconnect_task:
|
171
180
|
self._reconnect_task.cancel()
|
@@ -209,6 +218,8 @@ class NatsConnectionManager:
|
|
209
218
|
pass
|
210
219
|
await self._nc.close()
|
211
220
|
|
221
|
+
self._initialized = False
|
222
|
+
|
212
223
|
async def disconnected_cb(self) -> None:
|
213
224
|
logger.info("Disconnected from NATS!")
|
214
225
|
self._last_unhealthy = time.monotonic()
|
nucliadb_utils/tests/nats.py
CHANGED
@@ -29,6 +29,7 @@ from io import BytesIO
|
|
29
29
|
from urllib.request import urlopen
|
30
30
|
from zipfile import ZipFile
|
31
31
|
|
32
|
+
import nats
|
32
33
|
import pytest
|
33
34
|
from pytest_docker_fixtures import images # type: ignore
|
34
35
|
from pytest_docker_fixtures.containers._base import BaseImage # type: ignore
|
@@ -256,3 +257,13 @@ def natsdocker(): # pragma: no cover
|
|
256
257
|
print("Started natsd docker")
|
257
258
|
yield f"nats://{nats_host}:{nats_port}"
|
258
259
|
nats_image.stop()
|
260
|
+
|
261
|
+
|
262
|
+
@pytest.fixture(scope="function")
|
263
|
+
async def nats_server(natsd: str):
|
264
|
+
yield natsd
|
265
|
+
|
266
|
+
# cleanup nats
|
267
|
+
nc = await nats.connect(servers=[natsd])
|
268
|
+
await nc.drain()
|
269
|
+
await nc.close()
|
{nucliadb_utils-6.2.1.post2706.dist-info → nucliadb_utils-6.2.1.post2716.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: nucliadb_utils
|
3
|
-
Version: 6.2.1.
|
3
|
+
Version: 6.2.1.post2716
|
4
4
|
Home-page: https://nuclia.com
|
5
5
|
License: BSD
|
6
6
|
Classifier: Development Status :: 4 - Beta
|
@@ -24,8 +24,8 @@ Requires-Dist: PyNaCl
|
|
24
24
|
Requires-Dist: pyjwt>=2.4.0
|
25
25
|
Requires-Dist: memorylru>=1.1.2
|
26
26
|
Requires-Dist: mrflagly>=0.2.9
|
27
|
-
Requires-Dist: nucliadb-protos>=6.2.1.
|
28
|
-
Requires-Dist: nucliadb-telemetry>=6.2.1.
|
27
|
+
Requires-Dist: nucliadb-protos>=6.2.1.post2716
|
28
|
+
Requires-Dist: nucliadb-telemetry>=6.2.1.post2716
|
29
29
|
Provides-Extra: cache
|
30
30
|
Requires-Dist: redis>=4.3.4; extra == "cache"
|
31
31
|
Requires-Dist: orjson>=3.6.7; extra == "cache"
|
@@ -8,7 +8,7 @@ nucliadb_utils/featureflagging.py,sha256=dKp8u4g52KTcupKFJkdGYk3Z2pGQdi_q7IaoY_G
|
|
8
8
|
nucliadb_utils/grpc.py,sha256=apu0uePnkGHCAT7GRQ9YZfRYyFj26kJ440i8jitbM3U,3314
|
9
9
|
nucliadb_utils/helpers.py,sha256=nPw8yod3hP-pxq80VF8QC36s7ygSg0dBUdfI-LatvCs,1600
|
10
10
|
nucliadb_utils/indexing.py,sha256=Luaqcar3CySpdYOFp6Q9Fyr8ZYwhYhaKRHQ_VGL78f8,2318
|
11
|
-
nucliadb_utils/nats.py,sha256=
|
11
|
+
nucliadb_utils/nats.py,sha256=99YJkK1QMfWDxKJK8u0acK0lLYb8yThalzulGETiT80,15266
|
12
12
|
nucliadb_utils/partition.py,sha256=jBgy4Hu5Iwn4gjbPPcthSykwf-qNx-GcLAIwbzPd1d0,1157
|
13
13
|
nucliadb_utils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
14
14
|
nucliadb_utils/run.py,sha256=Es0_Bu5Yc-LWczvwL6gzWqSwC85RjDCk-0oFQAJi9g4,1827
|
@@ -57,10 +57,10 @@ nucliadb_utils/tests/fixtures.py,sha256=i0sqPqe5a5JlKGFdaIvOlHYkZ3pHZ2hTIgTsaIB3
|
|
57
57
|
nucliadb_utils/tests/gcs.py,sha256=KW_DLet1WRlssSW55eI-IQ-0d94Jo2Oh7Di4xGv4JCc,4685
|
58
58
|
nucliadb_utils/tests/indexing.py,sha256=YW2QhkhO9Q_8A4kKWJaWSvXvyQ_AiAwY1VylcfVQFxk,1513
|
59
59
|
nucliadb_utils/tests/local.py,sha256=fXIBasrvdaFJM-sw2wk1_oiFzBcm9O10iCyC-OiXwY8,1914
|
60
|
-
nucliadb_utils/tests/nats.py,sha256=
|
60
|
+
nucliadb_utils/tests/nats.py,sha256=nykEfwxPc3F3aO8n7g_V7IY3RQBXU3_R_ukwBKxYXa8,7893
|
61
61
|
nucliadb_utils/tests/s3.py,sha256=pl-RJFjA4MH6iXkqhsh5g8gDuEhrYu1nPZ-laxlrMlE,3704
|
62
|
-
nucliadb_utils-6.2.1.
|
63
|
-
nucliadb_utils-6.2.1.
|
64
|
-
nucliadb_utils-6.2.1.
|
65
|
-
nucliadb_utils-6.2.1.
|
66
|
-
nucliadb_utils-6.2.1.
|
62
|
+
nucliadb_utils-6.2.1.post2716.dist-info/METADATA,sha256=pPpkXMVwOGk63XzFzShhQfQvSpMibwDXZ0eRQH3y5Dk,2055
|
63
|
+
nucliadb_utils-6.2.1.post2716.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
64
|
+
nucliadb_utils-6.2.1.post2716.dist-info/top_level.txt,sha256=fE3vJtALTfgh7bcAWcNhcfXkNPp_eVVpbKK-2IYua3E,15
|
65
|
+
nucliadb_utils-6.2.1.post2716.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
66
|
+
nucliadb_utils-6.2.1.post2716.dist-info/RECORD,,
|
File without changes
|
{nucliadb_utils-6.2.1.post2706.dist-info → nucliadb_utils-6.2.1.post2716.dist-info}/top_level.txt
RENAMED
File without changes
|
{nucliadb_utils-6.2.1.post2706.dist-info → nucliadb_utils-6.2.1.post2716.dist-info}/zip-safe
RENAMED
File without changes
|