Fix: Prevent crashing with multiple changes in succession to same file #52
Merged
Merged
Conversation
Member
|
This looks very useful, thanks! Give me some time to look it over please, it might take until Monday. |
Member
|
I'm incredibly curious how (and why) you use an afterWrite hook to update the files you're editing. For me my markdown files are the source of truth, and I wouldn't really edit them from Saga, so my imagination fails me for how such a workflow could be useful. Sounds very cool though, I'd love to hear more! |
Contributor
Author
|
@kevinrenskers Thanks for merging. I have a module that is suggesting SEO metadata for unpublished articles based on the content as I write using Foundation modules. |
Member
|
Oh, that's pretty cool. Neat idea! |
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.
I had a collision happen when I implemented an afterWrite hook that updates the file I'm editing with new tags and front matter generated from the content in the updated file.
There is a conflict with the current saga code leading to crashes because it spawned independent Tasks that were changing shared state.
I am submitting a patch that prevents this issue from happening by creating a coordinator that consolidates the paths and prevents multiple tasks trying to change shared state.
hope this can be integrated into saga proper. Let me know if you need any additional details.