Update playlists in parallel

This commit is contained in:
GGAutomaton 2022-06-23 20:36:21 +08:00
parent 9ecef6f011
commit 4e401bc059
1 changed files with 8 additions and 13 deletions

View File

@ -454,21 +454,16 @@ public final class BookmarkFragment extends BaseLocalListFragment<List<PlaylistL
// 1. Update local playlists // 1. Update local playlists
// 2. Update remote playlists // 2. Update remote playlists
// 3. Set isModified false // 3. Set NoChangesToSave
disposables.add(localPlaylistManager.updatePlaylists(localItemsUpdate, localItemsDeleteUid) disposables.add(localPlaylistManager.updatePlaylists(localItemsUpdate, localItemsDeleteUid)
.mergeWith(remotePlaylistManager.updatePlaylists(
remoteItemsUpdate, remoteItemsDeleteUid))
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(() -> disposables.add(remotePlaylistManager.updatePlaylists( .subscribe(() -> {
remoteItemsUpdate, remoteItemsDeleteUid) if (debounceSaver != null) {
.observeOn(AndroidSchedulers.mainThread()) debounceSaver.setNoChangesToSave();
.subscribe(() -> { }
if (debounceSaver != null) { },
debounceSaver.setNoChangesToSave();
}
},
throwable -> showError(new ErrorInfo(throwable,
UserAction.REQUESTED_BOOKMARK,
"Saving playlist"))
)),
throwable -> showError(new ErrorInfo(throwable, throwable -> showError(new ErrorInfo(throwable,
UserAction.REQUESTED_BOOKMARK, "Saving playlist")) UserAction.REQUESTED_BOOKMARK, "Saving playlist"))
)); ));