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

running automerge-repo in a worker thread? #395

Open
michaelpalumbo opened this issue Oct 31, 2024 · 2 comments
Open

running automerge-repo in a worker thread? #395

michaelpalumbo opened this issue Oct 31, 2024 · 2 comments

Comments

@michaelpalumbo
Copy link

hi there, i'm making a new app the involves a some cpu-intensive stuff involving reactflow, web audio and making a lot of edits in automerge. i've noticed that the ui updates slow down a lot when i integrated automerge, and so i'm wondering if it's possible to run automerge-repo in a worker thread? I've made a few attempts at this, but it seems either vite or automerge don't play nicely with workers.

@alexjg
Copy link
Contributor

alexjg commented Oct 31, 2024

You can definitely run automerge in a worker thread - we do this a lot in various projects including tiny essay editor. What error specifically are you getting?

@michaelpalumbo
Copy link
Author

Oh, that's encouraging—thank you, I really appreciate this response. I regret that I’m unable to share a specific error right now, and I recognize that’s not very helpful here. Generally, it seems like the worker isn’t initializing the document or perhaps isn’t loading libraries either in the right order or at the right time. I also realize I’m a bit unclear on which parts of Automerge should be running in the worker versus the main thread

Would you have any guidance on structuring worker scripts with Automerge, or on specific library imports that should happen in the worker setup? I’d be grateful for any general advice on how to handle this kind of initialization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants