[PR #1748] Fixes unaccurate syncing issues and potential fix for extremly large sessions #1680

Open
opened 2026-04-25 00:00:34 +02:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf-app/pull/1748
Author: @Vito0912
Created: 12/9/2025
Status: 🔄 Open

Base: masterHead: fixSync


📝 Commits (4)

  • 9c66f6a Fix syncing being inaccurate and fix potential session sync bug
  • 97b573c Forgot to add fallback and downgraded gradle again
  • 89fbf68 Fix session reset and fix data types
  • a3c061f Revert sync cap

📊 Changes

3 files changed (+9 additions, -8 deletions)

View changed files

📝 android/app/src/main/java/com/audiobookshelf/app/data/LocalLibraryItem.kt (+1 -1)
📝 android/app/src/main/java/com/audiobookshelf/app/data/PlaybackSession.kt (+2 -2)
📝 android/app/src/main/java/com/audiobookshelf/app/media/MediaProgressSyncer.kt (+6 -5)

📄 Description

Brief summary

Uses a Double instead of a Long, because the app used to send 14.9xx, which always got casted to 14.
Now it uses precision (as it does for iOS). For this also the syncLastTime has been moved before the acutal request, because the server response time was always deducted from the next listening sync.

Also added a logic, to prevent syncs that are to big. If a sync exceeds 180 seconds (which is at max 3 times syncing), then it resets the listened time back to 0. There is no chance that 180 seconds should be accomplished. This isn't really a fix for larger sessions, but should help a lot not having them at all. At max 3 minutes are lost from listening

Which issue is fixed?

Discord, potential a few more

Pull Request Type

Android, backend

In-depth Description

See Discord conversation. Casting always "removes" a second of listened time

How have you tested this?

Mobile app

Screenshots


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/advplyr/audiobookshelf-app/pull/1748 **Author:** [@Vito0912](https://github.com/Vito0912) **Created:** 12/9/2025 **Status:** 🔄 Open **Base:** `master` ← **Head:** `fixSync` --- ### 📝 Commits (4) - [`9c66f6a`](https://github.com/advplyr/audiobookshelf-app/commit/9c66f6a673d73695403d619180217773a82d4229) Fix syncing being inaccurate and fix potential session sync bug - [`97b573c`](https://github.com/advplyr/audiobookshelf-app/commit/97b573c4277e61243e11faa6ebbf6e456e89c728) Forgot to add fallback and downgraded gradle again - [`89fbf68`](https://github.com/advplyr/audiobookshelf-app/commit/89fbf682215890d65358557b973f85e1e319bc37) Fix session reset and fix data types - [`a3c061f`](https://github.com/advplyr/audiobookshelf-app/commit/a3c061f5f68acd4beee958bb7419590318ebda42) Revert sync cap ### 📊 Changes **3 files changed** (+9 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `android/app/src/main/java/com/audiobookshelf/app/data/LocalLibraryItem.kt` (+1 -1) 📝 `android/app/src/main/java/com/audiobookshelf/app/data/PlaybackSession.kt` (+2 -2) 📝 `android/app/src/main/java/com/audiobookshelf/app/media/MediaProgressSyncer.kt` (+6 -5) </details> ### 📄 Description <!-- For Work In Progress Pull Requests, please use the Draft PR feature, see https://github.blog/2019-02-14-introducing-draft-pull-requests/ for further details. If you do not follow this template, the PR may be closed without review. Please ensure all checks pass. If you are a new contributor, the workflows will need to be manually approved before they run. --> ## Brief summary Uses a `Double` instead of a `Long`, because the app used to send `14.9xx`, which always got casted to `14`. Now it uses precision (as it does for iOS). For this also the syncLastTime has been moved before the acutal request, because the server response time was always deducted from the next listening sync. Also added a logic, to prevent syncs that are to big. If a sync exceeds 180 seconds (which is at max 3 times syncing), then it resets the listened time back to 0. There is no chance that 180 seconds should be accomplished. This isn't really a fix for larger sessions, but should help a lot not having them at all. At max 3 minutes are lost from listening ## Which issue is fixed? Discord, potential a few more ## Pull Request Type Android, backend ## In-depth Description See Discord conversation. Casting always "removes" a second of listened time ## How have you tested this? Mobile app ## Screenshots <!-- If your PR includes any changes to the front-end, please include screenshots or a short video from before and after your changes. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-04-25 00:00:34 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf-app#1680