[PR #4454] [MERGED] Fix manually setting updatedAt of mediaProgresses using progress sync lastUpdate timestamp #4259

Closed
opened 2026-04-25 00:19:02 +02:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf/pull/4454
Author: @advplyr
Created: 7/2/2025
Status: Merged
Merged: 7/2/2025
Merged by: @advplyr

Base: masterHead: fix_mediaprogress_updatedat_2


📝 Commits (1)

  • 596bddf Fix manually setting updatedAt of mediaProgresses using progress sync lastUpdate timestamp #4366

📊 Changes

1 file changed (+14 additions, -5 deletions)

View changed files

📝 server/models/MediaProgress.js (+14 -5)

📄 Description

Brief summary

In https://github.com/advplyr/audiobookshelf/pull/4326 I attempted to fix the issue where the updatedAt datetime was not being set using the timestamp in the request for media progress. That solution didn't work and instead the updatedAt remains unchanged on local media progress syncs.

This PR fixes that issue by running a separate raw query to set the updatedAt datetime.

Which issue is fixed?

Fixes #4366 and possibly mobile app sync issues for downloaded media.

In-depth Description

Sequelize v6 doesn't support manually setting the updatedAt timestamp. After trying all the suggested workarounds mentioned in issue threads on their repo I was only able to manually set it with a raw query.

This additional query only runs when the lastUpdate unix timestamp is included in requests to update media progress. That is used for syncing local progress.

Side note: Sequelize returns the correct datetime after saving but the datetime in the database is not changed or is the current time if not setting the silent flag.

How have you tested this?

Tested on android with offline local sessions.


🔄 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/pull/4454 **Author:** [@advplyr](https://github.com/advplyr) **Created:** 7/2/2025 **Status:** ✅ Merged **Merged:** 7/2/2025 **Merged by:** [@advplyr](https://github.com/advplyr) **Base:** `master` ← **Head:** `fix_mediaprogress_updatedat_2` --- ### 📝 Commits (1) - [`596bddf`](https://github.com/advplyr/audiobookshelf/commit/596bddf791de0781010b17fba5536a367a68e8b4) Fix manually setting updatedAt of mediaProgresses using progress sync lastUpdate timestamp #4366 ### 📊 Changes **1 file changed** (+14 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `server/models/MediaProgress.js` (+14 -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 In https://github.com/advplyr/audiobookshelf/pull/4326 I attempted to fix the issue where the `updatedAt` datetime was not being set using the timestamp in the request for media progress. That solution didn't work and instead the `updatedAt` remains unchanged on local media progress syncs. This PR fixes that issue by running a separate raw query to set the `updatedAt` datetime. ## Which issue is fixed? Fixes #4366 and possibly mobile app sync issues for downloaded media. ## In-depth Description Sequelize v6 doesn't support manually setting the `updatedAt` timestamp. After trying all the suggested workarounds mentioned in issue threads on their repo I was only able to manually set it with a raw query. This additional query only runs when the `lastUpdate` unix timestamp is included in requests to update media progress. That is used for syncing local progress. Side note: Sequelize returns the correct datetime after saving but the datetime in the database is not changed or is the current time if not setting the `silent` flag. ## How have you tested this? Tested on android with offline local sessions. --- <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:19:02 +02:00
adam closed this issue 2026-04-25 00:19:02 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#4259