@@ -38,7 +38,6 @@ import 'package:ardrive/utils/snapshots/snapshot_drive_history.dart';
38
38
import 'package:ardrive/utils/snapshots/snapshot_item.dart' ;
39
39
import 'package:ardrive_utils/ardrive_utils.dart' ;
40
40
import 'package:ario_sdk/ario_sdk.dart' ;
41
- import 'package:pool/pool.dart' ;
42
41
import 'package:arweave/arweave.dart' ;
43
42
import 'package:cryptography/cryptography.dart' ;
44
43
import 'package:drift/drift.dart' ;
@@ -608,6 +607,8 @@ class _SyncRepository implements SyncRepository {
608
607
ownerAddress: ownerAddress,
609
608
);
610
609
610
+ txFechedCallback? .call (drive.id, gqlDriveHistory.txCount);
611
+
611
612
logger.d ('Total range to query for: ${totalRangeToQueryFor .rangeSegments }\n '
612
613
'Sub ranges in snapshots (DRIVE ID: $driveId ): ${snapshotDriveHistory .subRanges .rangeSegments }\n '
613
614
'Sub ranges in GQL (DRIVE ID: $driveId ): ${gqlDriveHistorySubRanges .rangeSegments }' );
@@ -770,40 +771,6 @@ class _SyncRepository implements SyncRepository {
770
771
fileEntities.clear ();
771
772
}
772
773
773
- final pool = Pool (_entityBatchSize);
774
- final runningTasks = < Future <void >> [];
775
-
776
- Future <void > parseTransaction (DriveEntityHistoryTransactionModel t) async {
777
- await for (final entity in _arweave.streamEntitiesFromTransactions (
778
- Stream .value (t),
779
- driveKey,
780
- driveId: drive.id,
781
- ownerAddress: ownerAddress,
782
- concurrency: 1 ,
783
- )) {
784
- if (entity is DriveEntity ) {
785
- driveEntities.add (entity);
786
- } else if (entity is FolderEntity ) {
787
- folderEntities.add (entity);
788
- } else if (entity is FileEntity ) {
789
- fileEntities.add (entity);
790
- }
791
- }
792
-
793
- numberOfDriveEntitiesParsed++ ;
794
-
795
- if (driveEntities.length +
796
- folderEntities.length +
797
- fileEntities.length >=
798
- _entityBatchSize) {
799
- await flush ();
800
- }
801
-
802
- controller.add (
803
- fetchPhaseWeight + driveEntityParseProgress () * parsePhaseWeight,
804
- );
805
- }
806
-
807
774
await for (final t in transactions) {
808
775
if (firstBlockHeight == null ) {
809
776
final block = t.transactionCommonMixin.block;
@@ -824,16 +791,36 @@ class _SyncRepository implements SyncRepository {
824
791
controller.add (fetchPhasePercentage * fetchPhaseWeight);
825
792
}
826
793
827
- final future = pool.withResource (() => parseTransaction (t));
828
- runningTasks.add (future);
829
- future.whenComplete (() => runningTasks.remove (future));
794
+ await for (final entity in _arweave.streamEntitiesFromTransactions (
795
+ Stream .value (t),
796
+ driveKey,
797
+ driveId: drive.id,
798
+ ownerAddress: ownerAddress,
799
+ concurrency: _entityBatchSize,
800
+ )) {
801
+ if (entity is DriveEntity ) {
802
+ driveEntities.add (entity);
803
+ } else if (entity is FolderEntity ) {
804
+ folderEntities.add (entity);
805
+ } else if (entity is FileEntity ) {
806
+ fileEntities.add (entity);
807
+ }
830
808
831
- if (runningTasks.length >= _entityBatchSize) {
832
- await Future .any (runningTasks);
809
+ if (driveEntities.length +
810
+ folderEntities.length +
811
+ fileEntities.length >=
812
+ _entityBatchSize) {
813
+ await flush ();
814
+ }
833
815
}
816
+
817
+ numberOfDriveEntitiesParsed++ ;
818
+
819
+ controller.add (
820
+ fetchPhaseWeight + driveEntityParseProgress () * parsePhaseWeight,
821
+ );
834
822
}
835
823
836
- await Future .wait (runningTasks);
837
824
await flush ();
838
825
839
826
if (numberOfDriveEntitiesToParse == 0 ) {
0 commit comments