mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-30 15:17:14 +02:00
Fix thread-safety with transaction on local media progress
This commit is contained in:
@@ -176,10 +176,10 @@ public class AbsDatabase: CAPPlugin {
|
||||
call.reject("Local media progress not found or created")
|
||||
return
|
||||
}
|
||||
localMediaProgress.updateFromServerMediaProgress(serverMediaProgress)
|
||||
|
||||
NSLog("syncServerMediaProgressWithLocalMediaProgress: Saving local media progress")
|
||||
Database.shared.saveLocalMediaProgress(localMediaProgress)
|
||||
localMediaProgress.updateFromServerMediaProgress(serverMediaProgress)
|
||||
|
||||
call.resolve(try localMediaProgress.asDictionary())
|
||||
} catch {
|
||||
call.reject("Failed to sync media progress")
|
||||
@@ -203,7 +203,6 @@ public class AbsDatabase: CAPPlugin {
|
||||
|
||||
// Update finished status
|
||||
localMediaProgress.updateIsFinished(isFinished)
|
||||
Database.shared.saveLocalMediaProgress(localMediaProgress)
|
||||
|
||||
// Build API response
|
||||
let progressDictionary = try? localMediaProgress.asDictionary()
|
||||
|
||||
Reference in New Issue
Block a user