Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Support for using multiple contexts at the same time? #290

Answered by james-pre
davidsm10 asked this question in Q&A
Discussion options

So I was trying to use the indexedDB backend in a document and at the same time in a Service worker, but it seems it can't be done without issues. I had issues after renaming files, also after creating them, no issues when reading already existing files though (I guess those are always pulled from the indexedDB).

Any plans to support using multiple contexts at the same time?
Any workaround that can be done at the moment to be able to use it this way?

I only need to use fs.promises.readFile() from the service worker, maybe there is a way to just force reloading the file system state before reading to sync the state with the file system saved on the indexedDB?

You must be logged in to vote

Hey @davidsm10,

it sounds like you want to use a backend with the same underlying data source in multiple threads.

Currently the only backend with support for this is SingleBuffer.

Multithreading with the same underlying data source is a very difficult problem. Perhaps if the ECMAScript structs proposal is accepted some official support could be added but until then I don't see multithreaded IndexedDB being a thing.

The Port backend is probably what you want, which can be combined with resolveRemoteMount for use across threads.

Replies: 2 comments

Comment options

Hey @davidsm10,

it sounds like you want to use a backend with the same underlying data source in multiple threads.

Currently the only backend with support for this is SingleBuffer.

Multithreading with the same underlying data source is a very difficult problem. Perhaps if the ECMAScript structs proposal is accepted some official support could be added but until then I don't see multithreaded IndexedDB being a thing.

The Port backend is probably what you want, which can be combined with resolveRemoteMount for use across threads.

You must be logged in to vote
0 replies
Answer selected by davidsm10
Comment options

Ok, thanks, I will try the Port backend.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /