浏览代码

Skip sync if already in progress

Vishnu Mohandas 4 年之前
父节点
当前提交
93b38bbe43
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      lib/main.dart

+ 3 - 0
lib/main.dart

@@ -64,6 +64,9 @@ Future _init() async {
 }
 }
 
 
 Future<void> _sync({bool isAppInBackground = false}) async {
 Future<void> _sync({bool isAppInBackground = false}) async {
+  if (SyncService.instance.isSyncInProgress()) {
+    return;
+  }
   try {
   try {
     await SyncService.instance.sync(isAppInBackground: isAppInBackground);
     await SyncService.instance.sync(isAppInBackground: isAppInBackground);
   } catch (e, s) {
   } catch (e, s) {