Skip to content

Commit 29666ea

Browse files
Merge pull request #141 from threefoldtech/development_fix_connect
Fix tfchain connect in case it's already connected
2 parents bbbfa77 + 1c46afd commit 29666ea

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/tfchain_client/lib/src/client.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,13 @@ class QueryClient {
8080
provider = connections[url]["provider"];
8181
api = connections[url]["api"];
8282
if (!provider!.isConnected()) {
83-
api.connect();
83+
try {
84+
await api.connect();
85+
} catch (e) {
86+
if (e.toString() != "Exception: Already connected") {
87+
throw e;
88+
}
89+
}
8490
}
8591
} else {
8692
provider = Provider.fromUri(Uri.parse(url));

0 commit comments

Comments
 (0)