syncAll method

Future<void> syncAll()

Implementation

Future<void> syncAll() async {
  LOG.printInfo(['TABLE_SYNC', 'syncAll requested', groupIDs.join(',')]);
  if (state.syncingAll) {
    LOG.printWarn(['TABLE_SYNC', 'syncAll ignored', 'already running']);
    return;
  }
  emit(state.copyWith(syncingAll: true));
  try {
    final batches = _buildParallelSyncBatches();
    for (var index = 0; index < batches.length; index++) {
      final batch = batches[index];
      LOG.printInfo([
        'TABLE_SYNC',
        'syncAll batch',
        '${index + 1}/${batches.length}',
        batch.join(','),
      ]);
      await Future.wait(batch.map(syncGroup));
    }
  } finally {
    if (!isClosed) emit(state.copyWith(syncingAll: false));
    LOG.printInfo(['TABLE_SYNC', 'syncAll finished']);
  }
}