(fix): retry when iota is unavailable
Some checks failed
/ build-mobile (push) Failing after 1m0s
/ build-web (push) Failing after 1m13s
/ build-desktop (linux) (push) Failing after 1m13s
/ release (push) Has been skipped

This commit is contained in:
Alois 2026-07-29 02:37:18 +02:00
commit 5ece90ef4b
Signed by: alois
SSH key fingerprint: SHA256:GBzT2DXvAuGV9XIV5W3WrzVpjU54FThmxHXdbz95J24
3 changed files with 23 additions and 13 deletions

View file

@ -435,15 +435,21 @@ export function Provider(props: {
const stateSync = new Promise<ProtocolMessage<"ClientStateSync">>(
(resolve, reject) => {
let unsubscribeStateSync = () => {};
let unsubscribeNoIota = () => {};
const cleanupStateSync = () => {
clearTimeout(timeout);
unsubscribeStateSync();
unsubscribeNoIota();
};
const timeout = setTimeout(() => {
unsubscribe();
cleanupStateSync();
reject(new Error("Initial state synchronization timed out"));
}, 120_000);
const unsubscribe = activeClient.subscribe(
unsubscribeStateSync = activeClient.subscribe(
"ClientStateSync",
(message) => {
clearTimeout(timeout);
unsubscribe();
cleanupStateSync();
try {
resolve(validateResponse("ClientStateSync", message));
} catch (error) {
@ -451,6 +457,10 @@ export function Provider(props: {
}
},
);
unsubscribeNoIota = activeClient.subscribe("ErrorNoIota", () => {
cleanupStateSync();
reject(new Error("No Iota is currently connected"));
});
},
);
const [, finalResponse] = await Promise.all([

16
pnpm-lock.yaml generated
View file

@ -6,7 +6,7 @@ settings:
overrides:
'@methanium/ui': https://git.methanium.net/methanium/ui/releases/download/0.0.10/methanium-ui.tgz
mtp: https://git.methanium.net/methanium/mtp/releases/download/0.2.0-dev-6f673ba/mtp-0.2.0.tgz
mtp: https://git.methanium.net/methanium/mtp/releases/download/0.2.0-dev-a692bed/mtp-0.2.0.tgz
importers:
@ -16,8 +16,8 @@ importers:
specifier: https://git.methanium.net/methanium/ui/releases/download/0.0.10/methanium-ui.tgz
version: https://git.methanium.net/methanium/ui/releases/download/0.0.10/methanium-ui.tgz(@date-fns/tz@1.5.0)(@types/react-dom@19.2.3(@types/react@19.2.17))(@types/react@19.2.17)(date-fns@4.4.0)(react-dom@19.2.7(react@19.2.7))(react-is@19.2.7)(react@19.2.7)(redux@5.0.1)(typescript@6.0.3)
mtp:
specifier: https://git.methanium.net/methanium/mtp/releases/download/0.2.0-dev-6f673ba/mtp-0.2.0.tgz
version: https://git.methanium.net/methanium/mtp/releases/download/0.2.0-dev-6f673ba/mtp-0.2.0.tgz
specifier: https://git.methanium.net/methanium/mtp/releases/download/0.2.0-dev-a692bed/mtp-0.2.0.tgz
version: https://git.methanium.net/methanium/mtp/releases/download/0.2.0-dev-a692bed/mtp-0.2.0.tgz
sonner:
specifier: ^2.0.7
version: 2.0.7(react-dom@19.2.7(react@19.2.7))(react@19.2.7)
@ -700,8 +700,8 @@ importers:
specifier: ^1.14.0
version: 1.23.0(react@19.2.7)
mtp:
specifier: https://git.methanium.net/methanium/mtp/releases/download/0.2.0-dev-6f673ba/mtp-0.2.0.tgz
version: https://git.methanium.net/methanium/mtp/releases/download/0.2.0-dev-6f673ba/mtp-0.2.0.tgz
specifier: https://git.methanium.net/methanium/mtp/releases/download/0.2.0-dev-a692bed/mtp-0.2.0.tgz
version: https://git.methanium.net/methanium/mtp/releases/download/0.2.0-dev-a692bed/mtp-0.2.0.tgz
react:
specifier: ^19.2.0
version: 19.2.7
@ -4006,8 +4006,8 @@ packages:
ms@2.1.3:
resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}
mtp@https://git.methanium.net/methanium/mtp/releases/download/0.2.0-dev-6f673ba/mtp-0.2.0.tgz:
resolution: {integrity: sha512-WcXHd53aDM0zQfO8eaUnK5tpnRP73GlWjwAMMcstcVAIWrvyFGuINkCRNEkb2RsNk9h57UMhxElCZeBkFrVmCg==, tarball: https://git.methanium.net/methanium/mtp/releases/download/0.2.0-dev-6f673ba/mtp-0.2.0.tgz}
mtp@https://git.methanium.net/methanium/mtp/releases/download/0.2.0-dev-a692bed/mtp-0.2.0.tgz:
resolution: {integrity: sha512-WcXHd53aDM0zQfO8eaUnK5tpnRP73GlWjwAMMcstcVAIWrvyFGuINkCRNEkb2RsNk9h57UMhxElCZeBkFrVmCg==, tarball: https://git.methanium.net/methanium/mtp/releases/download/0.2.0-dev-a692bed/mtp-0.2.0.tgz}
version: 0.2.0
nanoid@3.3.15:
@ -8254,7 +8254,7 @@ snapshots:
ms@2.1.3: {}
mtp@https://git.methanium.net/methanium/mtp/releases/download/0.2.0-dev-6f673ba/mtp-0.2.0.tgz:
mtp@https://git.methanium.net/methanium/mtp/releases/download/0.2.0-dev-a692bed/mtp-0.2.0.tgz:
dependencies:
yaml: 2.9.0

View file

@ -7,4 +7,4 @@ allowBuilds:
esbuild: true
overrides:
"@methanium/ui": "https://git.methanium.net/methanium/ui/releases/download/0.0.10/methanium-ui.tgz"
mtp: "https://git.methanium.net/methanium/mtp/releases/download/0.2.0-dev-6f673ba/mtp-0.2.0.tgz"
mtp: "https://git.methanium.net/methanium/mtp/releases/download/0.2.0-dev-a692bed/mtp-0.2.0.tgz"