Browse Source

update rpc retry times

pull/18/head
Sun 4 years ago
parent
commit
6e7a6926bd
  1. 12
      lib/rpc.dart

12
lib/rpc.dart

@ -69,7 +69,7 @@ class WebSocketsNotifications { @@ -69,7 +69,7 @@ class WebSocketsNotifications {
Future<bool> init(String addr) async {
reset();
var i = 0;
var i = 2;
while (true) {
try {
@ -88,14 +88,14 @@ class WebSocketsNotifications { @@ -88,14 +88,14 @@ class WebSocketsNotifications {
});
return true;
} catch (e) {
print("DEBUG Flutter: got websockt error.........retry");
print("DEBUG Flutter: got websockt error.........retry ${i}s");
//print(e);
if (i > 3) {
if (i > 100) {
print("DEBUG Flutter: got websockt error.");
return false;
}
i += 1;
await Future.delayed(Duration(seconds: 1), () => true);
await Future.delayed(Duration(seconds: i), () => true);
i = i * 2; // 2, 4, 8, 16, 32, 64
continue;
}
}

Loading…
Cancel
Save