mirror of
https://github.com/StarCitizenToolBox/app.git
synced 2026-02-06 15:10:20 +00:00
feat: AdaptiveConcurrencyController
This commit is contained in:
@@ -52,14 +52,14 @@ class DownloadManager extends _$DownloadManager {
|
||||
|
||||
// Lazy load init
|
||||
() async {
|
||||
await Future.delayed(const Duration(milliseconds: 16));
|
||||
try {
|
||||
// Check if there are existing tasks (check working dir for session data)
|
||||
final dir = Directory(workingDir);
|
||||
if (await dir.exists()) {
|
||||
dPrint("Launch download manager");
|
||||
// Check if there are pending tasks to restore (without starting the downloader)
|
||||
if (downloader_api.downloaderHasPendingSessionTasks(workingDir: workingDir)) {
|
||||
dPrint("Launch download manager - found pending session tasks");
|
||||
await initDownloader();
|
||||
} else {
|
||||
dPrint("LazyLoad download manager");
|
||||
dPrint("LazyLoad download manager - no pending tasks");
|
||||
}
|
||||
} catch (e) {
|
||||
dPrint("DownloadManager.checkLazyLoad Error:$e");
|
||||
@@ -246,4 +246,15 @@ class DownloadManager extends _$DownloadManager {
|
||||
}
|
||||
return await downloader_api.downloaderHasActiveTasks();
|
||||
}
|
||||
|
||||
/// Get all completed tasks from cache (tasks that were removed by removeCompletedTasks)
|
||||
/// This cache is cleared when the downloader is shutdown/restarted
|
||||
List<downloader_api.DownloadTaskInfo> getCompletedTasksCache() {
|
||||
return downloader_api.downloaderGetCompletedTasksCache();
|
||||
}
|
||||
|
||||
/// Clear the completed tasks cache manually
|
||||
void clearCompletedTasksCache() {
|
||||
downloader_api.downloaderClearCompletedTasksCache();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ final class DownloadManagerProvider
|
||||
}
|
||||
}
|
||||
|
||||
String _$downloadManagerHash() => r'f12d3fb1d7c03fdfccff7d07903218f38a860437';
|
||||
String _$downloadManagerHash() => r'55c92224a5eb6bb0f84f0a97fd0585b94f61f711';
|
||||
|
||||
abstract class _$DownloadManager extends $Notifier<DownloadManagerState> {
|
||||
DownloadManagerState build();
|
||||
|
||||
Reference in New Issue
Block a user