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

fix: ensures autosaves run sequentially rather than ever in parallel #9809

Closed
wants to merge 2 commits into from

Conversation

jmikrut
Copy link
Member

@jmikrut jmikrut commented Dec 7, 2024

With a small autosave interval, it's possible for two autosaves to be executing in parallel.

This PR ensures that you can fire many autosaves, but they will be executed sequentially rather than ever being able to be run in parallel.

}, [isProcessing, queue])

// Process the queue whenever it changes
useEffect(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we do this without a useEffect? Seems like it should be possible

Copy link
Member Author

Choose a reason for hiding this comment

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

I would love to learn

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it cant, I hate it but will live

Copy link
Contributor

Choose a reason for hiding this comment

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

Can't you just call processCurrentAutosave and have it take the autosave function as an arg and leave everything else as it is? Removing the autosave state and the useEffect?

@JarrodMFlesch
Copy link
Contributor

JarrodMFlesch commented Dec 7, 2024

Should update the description here, I think your initial commit allowed them to fire sequentially but now it just allows 1 to run and future autosaves cannot be called if the prev one has not finished.

@jmikrut
Copy link
Member Author

jmikrut commented Dec 11, 2024

Closing in favor of #9892

@jmikrut jmikrut closed this Dec 11, 2024
@jmikrut jmikrut deleted the fix/autosave-sequential branch December 20, 2024 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants