maybeAutoCheckpoint method

Future<void> maybeAutoCheckpoint(
  1. int currentWalRecordCount
)

Implementation

Future<void> maybeAutoCheckpoint(int currentWalRecordCount) async {
  if (currentWalRecordCount >= autocheckpointThreshold) {
    print('[Checkpoint] Autocheckpoint triggered '
          '(walRecords=$currentWalRecordCount >= threshold=$autocheckpointThreshold)');
    try {
      await runCheckpoint();
    } catch (e) {
      // Checkpoint failure is not fatal — WAL will be replayed on next restart
      print('[Checkpoint] Autocheckpoint failed (non-fatal): $e');
    }
  }
}