Retry sync when a background task is executed within the same isolate

This commit is contained in:
vishnukvmd 2021-11-28 10:52:14 +05:30
parent 0ebfe2760e
commit 506dc2af73

View file

@ -66,9 +66,15 @@ Future<void> _runInForeground() async {
}
Future<void> _runBackgroundTask(String taskId) async {
_runWithLogs(() async {
_runInBackground(taskId);
}, prefix: "[bg]");
if (Platform.isIOS && _isProcessRunning) {
_logger.info("Background task triggered when process was already running");
await _sync();
BackgroundFetch.finish(taskId);
} else {
_runWithLogs(() async {
_runInBackground(taskId);
}, prefix: "[bg]");
}
}
Future<void> _runInBackground(String taskId) async {