performCleanup static method

Future<void> performCleanup()

Performs cleanup of orphaned files and invalid resume states

Implementation

static Future<void> performCleanup() async {
  try {
    // print('Performing comprehensive model cleanup...');

    // 1. Enhanced file system cleanup
    final protectedFiles = await ModelPreferencesManager.getAllProtectedFiles();
    await ModelFileSystemManager.cleanupOrphanedFiles(
      protectedFiles: protectedFiles,
      enableResumeDetection: true,
    );

    // 2. Task registry cleanup
    await _cleanupTaskRegistry();

    // 3. Background_downloader cleanup
    await _cleanupBackgroundDownloaderResources();

    // print('Comprehensive model cleanup completed');
  } catch (e) {
    // print('Model cleanup failed: $e');
  }
}