private void scheduleCompletion ( Snapshot snapshot ) { stateContext . schedule ( SNAPSHOT_COMPLETION_DELAY , ( ) -> { if ( completeSnapshot ( snapshot . index ( ) ) ) { logger . debug ( "Completing snapshot {}" , snapshot . index ( ) ) ; snapshot . complete ( ) ; // If log compaction is being forced, immediately compact the logs. if ( ! raft . getLoadMonitor ( ) . isUnderHighLoad ( ) || isRunningOutOfDiskSpace ( ) || isRunningOutOfMemory ( ) ) { compactLogs ( snapshot . index ( ) ) ; } else { scheduleCompaction ( snapshot . index ( ) ) ; } } else { scheduleCompletion ( snapshot ) ; } } ) ; }
Schedules a completion check for the snapshot at the given index .