Skip to content

基于自定义规则的番剧采集APP,支持流媒体在线观看,支持弹幕,支持实时超分辨率。

speedup webdav sync

Predidit0aa9acd6f0b8
diff --git a/lib/utils/webdav.dart b/lib/utils/webdav.dart
index 0a9fc06e..39f225e3 100644
--- a/lib/utils/webdav.dart
+++ b/lib/utils/webdav.dart
@@ -70,6 +70,9 @@ class WebDav {
}
Future<void> updateCollectibles() async {
+ // don't try muliti thread update here
+ // some webdav server may not support muliti thread write
+ // you will get 423 locked error
await update('collectibles');
if (GStorage.collectChanges.isNotEmpty) {
await update('collectchanges');
@@ -125,17 +128,17 @@ class WebDav {
Future<void> syncCollectibles() async {
List<CollectedBangumi> remoteCollectibles = [];
List<CollectedBangumiChange> remoteChanges = [];
- try {
- await downloadCollectibles();
- } catch (e) {
+
+ // muliti thread download
+ Future<void> collectiblesFuture = downloadCollectibles().catchError((e) {
KazumiLogger().log(Level.error, 'webDav download collectibles failed $e');
- }
- try {
- await downloadCollectChanges();
- } catch (e) {
+ });
+ Future<void> changesFuture = downloadCollectChanges().catchError((e) {
KazumiLogger()
.log(Level.error, 'webDav download collect changes failed $e');
- }
+ });
+ await Future.wait([collectiblesFuture, changesFuture]);
+
try {
remoteCollectibles = await GStorage.getCollectiblesFromFile(
'${webDavLocalTempDirectory.path}/collectibles.tmp');