Skip to content

Commit 33e784c

Browse files
committed
[webApi] properly close upon trying to re-establish connection
1 parent 506777a commit 33e784c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

app/lib/service/substrate_api/api.dart

+3-2
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,11 @@ class Api {
6161
Future<void> init() async {
6262
_connecting = _connect();
6363

64-
_timer = Timer.periodic(const Duration(seconds: 10), (timer) {
64+
_timer = Timer.periodic(const Duration(seconds: 10), (timer) async {
6565
if (!provider.isConnected()) {
66-
if (_connecting == null) {
66+
if (_connecting == null) {
6767
Log.p('[webApi] provider is disconnected. Trying to connect again...');
68+
await close();
6869
_connecting = _connect();
6970
} else {
7071
Log.p('[webApi] still trying to connect..');

0 commit comments

Comments
 (0)