@le-space/core 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/index.js +6 -9
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -739,25 +739,22 @@ async function postBroadcastPayload(body, options) {
|
|
|
739
739
|
};
|
|
740
740
|
}
|
|
741
741
|
async function broadcastAlephMessage(message, options) {
|
|
742
|
-
const
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
];
|
|
747
|
-
for (let index = 0; index < attempts.length; index += 1) {
|
|
748
|
-
const result = await postBroadcastPayload(attempts[index], {
|
|
742
|
+
const requestBody = { sync: options.sync ?? false, message };
|
|
743
|
+
const maxAttempts = 3;
|
|
744
|
+
for (let index = 0; index < maxAttempts; index += 1) {
|
|
745
|
+
const result = await postBroadcastPayload(requestBody, {
|
|
749
746
|
apiHost: options.apiHost,
|
|
750
747
|
fetch: options.fetch
|
|
751
748
|
});
|
|
752
749
|
if (result.httpStatus === 202 || normalizeBroadcastStatus(result.httpStatus, result.response?.message_status) !== "unknown" || result.httpStatus >= 200 && result.httpStatus < 300) {
|
|
753
750
|
return result;
|
|
754
751
|
}
|
|
755
|
-
const canRetry = index <
|
|
752
|
+
const canRetry = index < maxAttempts - 1 && isRetryableBroadcastFailure({ status: result.httpStatus }, result.response);
|
|
756
753
|
if (!canRetry) {
|
|
757
754
|
throw new Error(`Broadcast failed: ${result.httpStatus} ${JSON.stringify(result.response ?? {})}`);
|
|
758
755
|
}
|
|
759
756
|
}
|
|
760
|
-
throw new Error("Broadcast failed:
|
|
757
|
+
throw new Error("Broadcast failed: retry budget exhausted");
|
|
761
758
|
}
|
|
762
759
|
|
|
763
760
|
// src/forget.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@le-space/core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.27",
|
|
4
4
|
"description": "Reusable Aleph deployment, runtime, and guest lifecycle logic.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@le-space/aleph-bootstrap": "0.3.
|
|
20
|
-
"@le-space/shared-types": "0.3.
|
|
19
|
+
"@le-space/aleph-bootstrap": "0.3.27",
|
|
20
|
+
"@le-space/shared-types": "0.3.27"
|
|
21
21
|
}
|
|
22
22
|
}
|