From f447d10a0320bdc0257eb224bd9e56a2342f48c9 Mon Sep 17 00:00:00 2001 From: Javed Hussein Date: Thu, 3 Mar 2022 21:34:40 +0530 Subject: [PATCH 1/3] refactor: update tx pending threshold to 240m PE-1067 --- lib/blocs/sync/sync_cubit.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/blocs/sync/sync_cubit.dart b/lib/blocs/sync/sync_cubit.dart index bc21c302b8..2469ec814b 100644 --- a/lib/blocs/sync/sync_cubit.dart +++ b/lib/blocs/sync/sync_cubit.dart @@ -21,7 +21,7 @@ import '../blocs.dart'; part 'sync_state.dart'; const kRequiredTxConfirmationCount = 15; -const kRequiredTxConfirmationPendingThreshold = 60; +const kRequiredTxConfirmationPendingThreshold = 240; const kSyncTimerDuration = 5; const kArConnectSyncTimerDuration = 2; From 83b36b1dc1777d7329cbb2a502cca6c9e0b70d50 Mon Sep 17 00:00:00 2001 From: Javed Hussein Date: Sun, 6 Mar 2022 09:52:08 +0530 Subject: [PATCH 2/3] perf(sync): :zap: improves sync to handle longer unbundling times updates pending transaction check threshold to 8 hours --- lib/blocs/sync/sync_cubit.dart | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/blocs/sync/sync_cubit.dart b/lib/blocs/sync/sync_cubit.dart index 2469ec814b..23d3ef93dc 100644 --- a/lib/blocs/sync/sync_cubit.dart +++ b/lib/blocs/sync/sync_cubit.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:math'; import 'package:ardrive/blocs/activity/activity_cubit.dart'; import 'package:ardrive/blocs/sync/ghost_folder.dart'; @@ -21,10 +22,11 @@ import '../blocs.dart'; part 'sync_state.dart'; const kRequiredTxConfirmationCount = 15; -const kRequiredTxConfirmationPendingThreshold = 240; +const kRequiredTxConfirmationPendingThreshold = 60 * 8; const kSyncTimerDuration = 5; const kArConnectSyncTimerDuration = 2; +const kBlockHeightLookBack = 240; /// The [SyncCubit] periodically syncs the user's owned and attached drives and their contents. /// It also checks the status of unconfirmed transactions made by revisions. @@ -161,7 +163,9 @@ class SyncCubit extends Cubit { final driveSyncProcesses = drives.map((drive) => _syncDrive( drive.id, - lastBlockHeight: drive.lastBlockHeight!, + lastBlockHeight: calculateSyncLastBlockHeight( + drive.lastBlockHeight!, + ), currentBlockheight: currentBlockHeight, ).onError((error, stackTrace) { print('Error syncing drive with id ${drive.id}'); @@ -183,6 +187,14 @@ class SyncCubit extends Cubit { emit(SyncIdle()); } + int calculateSyncLastBlockHeight(int lastBlockHeight) { + if (_lastSync != null) { + return lastBlockHeight; + } else { + return max(lastBlockHeight - kBlockHeightLookBack, 0); + } + } + Future createGhosts({String? ownerAddress}) async { //Finalize missing parent list From cdf43f630f529636cacc01dcae40c5aaf374260d Mon Sep 17 00:00:00 2001 From: Javed Hussein Date: Mon, 7 Mar 2022 23:05:25 +0530 Subject: [PATCH 3/3] chore: update index.html version number --- web/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/index.html b/web/index.html index badb61af01..c3e95169cb 100644 --- a/web/index.html +++ b/web/index.html @@ -37,7 +37,7 @@ - +