@le-space/rootfs 0.3.25 → 0.3.27
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.
- package/package.json +1 -1
- package/reference/orbitdb-relay-pinner/rootfs/orbitdb-relay-pinner-bootstrap-refresh.py +13 -10
- package/reference/uc-go-peer/rootfs/uc-go-peer-bootstrap-deregister.py +6 -12
- package/reference/uc-go-peer/rootfs/uc-go-peer-bootstrap-refresh.py +6 -12
- package/reference/uc-go-peer/rootfs/uc-go-peer-setup-server.py +6 -12
package/package.json
CHANGED
|
@@ -306,19 +306,22 @@ def sign_aleph_message(unsigned_message: dict[str, object], private_key: str) ->
|
|
|
306
306
|
|
|
307
307
|
def broadcast_aleph_message(api_host: str, message: dict[str, object]) -> tuple[int, dict]:
|
|
308
308
|
url = urllib.parse.urljoin(api_host.rstrip("/") + "/", "api/v0/messages")
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
{**message, "sync": True},
|
|
312
|
-
dict(message),
|
|
313
|
-
]
|
|
309
|
+
request_body = {"sync": True, "message": message}
|
|
310
|
+
max_attempts = 3
|
|
314
311
|
last: tuple[int, dict] | None = None
|
|
315
|
-
for
|
|
316
|
-
last = post_json(url,
|
|
312
|
+
for index in range(max_attempts):
|
|
313
|
+
last = post_json(url, request_body)
|
|
317
314
|
if 200 <= last[0] < 300:
|
|
318
315
|
return last
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
316
|
+
publication_status = last[1].get("publication_status") if isinstance(last[1], dict) else None
|
|
317
|
+
retryable = last[0] >= 500 or (
|
|
318
|
+
isinstance(publication_status, dict)
|
|
319
|
+
and isinstance(publication_status.get("status"), str)
|
|
320
|
+
and publication_status.get("status").strip().lower() == "error"
|
|
321
|
+
)
|
|
322
|
+
if index >= max_attempts - 1 or not retryable:
|
|
323
|
+
raise RuntimeError(f"Aleph broadcast failed: {last[0]} {json_dumps(last[1])}")
|
|
324
|
+
raise RuntimeError("Aleph broadcast failed: retry budget exhausted")
|
|
322
325
|
|
|
323
326
|
|
|
324
327
|
def parse_post_record(entry: object) -> dict[str, object] | None:
|
|
@@ -155,22 +155,16 @@ def is_retryable_broadcast_failure(http_status: int, payload: object) -> bool:
|
|
|
155
155
|
|
|
156
156
|
def broadcast_aleph_message(api_host: str, message: dict[str, object]) -> tuple[int, object]:
|
|
157
157
|
url = urllib.parse.urljoin(api_host.rstrip("/") + "/", "api/v0/messages")
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
]
|
|
163
|
-
for index, attempt in enumerate(attempts):
|
|
164
|
-
http_status, payload = post_json(url, attempt)
|
|
158
|
+
request_body = {"sync": True, "message": message}
|
|
159
|
+
max_attempts = 3
|
|
160
|
+
for index in range(max_attempts):
|
|
161
|
+
http_status, payload = post_json(url, request_body)
|
|
165
162
|
if 200 <= http_status < 300:
|
|
166
163
|
return http_status, payload
|
|
167
|
-
can_retry = index <
|
|
168
|
-
is_invalid_message_format(http_status, payload)
|
|
169
|
-
or is_retryable_broadcast_failure(http_status, payload)
|
|
170
|
-
)
|
|
164
|
+
can_retry = index < max_attempts - 1 and is_retryable_broadcast_failure(http_status, payload)
|
|
171
165
|
if not can_retry:
|
|
172
166
|
raise RuntimeError(f"Aleph broadcast failed: {http_status} {json_dumps(payload)}")
|
|
173
|
-
raise RuntimeError("Aleph broadcast failed:
|
|
167
|
+
raise RuntimeError("Aleph broadcast failed: retry budget exhausted")
|
|
174
168
|
|
|
175
169
|
|
|
176
170
|
def parse_post_record(entry: object) -> dict[str, object] | None:
|
|
@@ -347,22 +347,16 @@ def is_retryable_broadcast_failure(http_status: int, payload: object) -> bool:
|
|
|
347
347
|
|
|
348
348
|
def broadcast_aleph_message(api_host: str, message: dict[str, object]) -> tuple[int, object]:
|
|
349
349
|
url = urllib.parse.urljoin(api_host.rstrip("/") + "/", "api/v0/messages")
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
]
|
|
355
|
-
for index, attempt in enumerate(attempts):
|
|
356
|
-
http_status, payload = post_json(url, attempt)
|
|
350
|
+
request_body = {"sync": True, "message": message}
|
|
351
|
+
max_attempts = 3
|
|
352
|
+
for index in range(max_attempts):
|
|
353
|
+
http_status, payload = post_json(url, request_body)
|
|
357
354
|
if 200 <= http_status < 300:
|
|
358
355
|
return http_status, payload
|
|
359
|
-
can_retry = index <
|
|
360
|
-
is_invalid_message_format(http_status, payload)
|
|
361
|
-
or is_retryable_broadcast_failure(http_status, payload)
|
|
362
|
-
)
|
|
356
|
+
can_retry = index < max_attempts - 1 and is_retryable_broadcast_failure(http_status, payload)
|
|
363
357
|
if not can_retry:
|
|
364
358
|
raise RuntimeError(f"Aleph broadcast failed: {http_status} {json_dumps(payload)}")
|
|
365
|
-
raise RuntimeError("Aleph broadcast failed:
|
|
359
|
+
raise RuntimeError("Aleph broadcast failed: retry budget exhausted")
|
|
366
360
|
|
|
367
361
|
|
|
368
362
|
def parse_post_record(entry: object) -> dict[str, object] | None:
|
|
@@ -284,24 +284,18 @@ def _post_json(url: str, body: dict[str, object]) -> tuple[int, object]:
|
|
|
284
284
|
|
|
285
285
|
def _broadcast_aleph_message(api_host: str, message: dict[str, object]) -> tuple[int, object]:
|
|
286
286
|
url = f"{api_host.rstrip('/')}/api/v0/messages"
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
]
|
|
292
|
-
for index, attempt in enumerate(attempts):
|
|
293
|
-
http_status, payload = _post_json(url, attempt)
|
|
287
|
+
request_body = {"sync": True, "message": message}
|
|
288
|
+
max_attempts = 3
|
|
289
|
+
for index in range(max_attempts):
|
|
290
|
+
http_status, payload = _post_json(url, request_body)
|
|
294
291
|
if 200 <= http_status < 300:
|
|
295
292
|
return http_status, payload
|
|
296
|
-
can_retry = index <
|
|
297
|
-
_is_invalid_message_format(http_status, payload)
|
|
298
|
-
or _is_retryable_broadcast_failure(http_status, payload)
|
|
299
|
-
)
|
|
293
|
+
can_retry = index < max_attempts - 1 and _is_retryable_broadcast_failure(http_status, payload)
|
|
300
294
|
if not can_retry:
|
|
301
295
|
raise RuntimeError(
|
|
302
296
|
f"Aleph bootstrap status broadcast failed: {http_status} {_json_dumps(payload)}"
|
|
303
297
|
)
|
|
304
|
-
raise RuntimeError("Aleph bootstrap status broadcast failed:
|
|
298
|
+
raise RuntimeError("Aleph bootstrap status broadcast failed: retry budget exhausted")
|
|
305
299
|
|
|
306
300
|
|
|
307
301
|
def _publish_vm_bootstrap_config_signal(record: dict) -> None:
|