Repository navigation
The filename-alt cleanup can't overwrite an edit saved while it runs - #1418
Merged
Merged
Conversation
clear_filename_alts parsed the body find_each loaded and wrote it back with update_column, so a rich text saved between that read and the write lost the newer body, silently and with no timestamp change. Each row is now cleaned inside with_lock, which reloads it under the write lock (SQLite's IMMEDIATE transaction) before it is parsed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
bin/rails action_text:clear_filename_altsparsed the bodyfind_eachhad loaded and wrote it back with
update_column. A rich text saved betweenthat read and the write lost its newer body, silently:
update_columnskips the timestamp, so nothing showed the edit was gone. The task is meant
to run once on a live deployment with pre-1.0 Lexxy content, which is where
someone may be editing.
Each row is now cleaned inside
with_lock, which reloads it under thewrite lock (SQLite's IMMEDIATE transaction) before it is parsed. A row with
nothing to change commits an empty transaction;
DRY_RUNstill writesnothing.
A new example yields a row loaded before an author's edit and asserts the
edit survives. It fails on
mainwith the stale body written back.Found by Copilot's review of the MClassrooms sync
(lsa-mis#119).
Verify
spec/tasks/action_text_spec.rb: 7 examples, 0 failures.bin/parallel-rspec: 6049 examples, 0 failures.