Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #13723 - race condition on asset observer for older migration #13748

Merged
merged 6 commits into from
Oct 13, 2023

Conversation

snipe
Copy link
Owner

@snipe snipe commented Oct 13, 2023

This should fix #13723, where there was a race condition firing a migration from earlier in 2023 which modifies the asset, but the observer touches fields that have not yet been created.

I mostly hate this (especially because we're going back in time to fix migrations) but this seems like the most sane way to clear the upgrade path.

@what-the-diff
Copy link

what-the-diff bot commented Oct 13, 2023

PR Summary

  • Code commenting in AssetObserver.php file
    The PR comprises a valuable addition of explanatory comments to the saving function within the AssetObserver.php file, allowing for better code understanding and smoother maintenance.

  • New assets table structure
    The PR introduces a new migration file which modifies the assets table structure by introducing new fields - asset_eol_date and eol_explicit. This modification will enhance data organization by including valuable information about the end-of-life date of an asset.

  • Addition of eol_explicit column if non-existent
    The PR includes another migration file which evaluates the existence of the eol_explicit column within the assets table. Should the column be non-existent, the migration file facilitates its creation. This offers flexibility and ensures the data integrity of the assets table.

Copy link
Collaborator

@uberbrady uberbrady left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a reasonable way to solve the problem. I think there are ways to save without firing observers, which might be another way to go about it - but this certainly does do the trick.

@snipe
Copy link
Owner Author

snipe commented Oct 13, 2023

Hm, good point. I could perhaps try saveQuietly() and/or withoutEvents() in that older migration...

Signed-off-by: snipe <[email protected]>
@snipe
Copy link
Owner Author

snipe commented Oct 13, 2023

@uberbrady can you peep this updated version?

Signed-off-by: snipe <[email protected]>
@snipe snipe requested a review from uberbrady October 13, 2023 11:35
Copy link
Collaborator

@uberbrady uberbrady left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this, it seems a bit cleaner - but if we really want to belt-and-suspenders this, I think it makes sense to have both in there at the same time. Especially since it’s so hard to test, I think I like that idea of trying to throw everything at the wall and just seeing what sticks.

@snipe snipe merged commit 04f6f39 into develop Oct 13, 2023
6 checks passed
@snipe snipe deleted the bug/sc-23830 branch October 13, 2023 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants