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

bugfix: Issue #455: StorageContext not saving data after deleting document/ref info #486

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/core/src/storage/kvStore/SimpleKVStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ export class SimpleKVStore extends BaseKVStore {
): Promise<boolean> {
if (key in this.data[collection]) {
delete this.data[collection][key];

if (this.persistPath) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@1997roylee thanks for looking into #455!
but persisting the whole store can take a long time, so doing it for every change operation seems not to be feasible. That's why we're having the explicit persist method.
We're working on a fix for #455.

Copy link
Author

Choose a reason for hiding this comment

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

It makes sense, but why is the 'persist' method checking if the instance is equal to 'BaseInMemoryKVStore'? I don't see any involvement of 'SimpleDocumentStore' with 'BaseInMemoryKVStore'.

I proposed to change the BaseInMemoryKVStore to SimpleKVStore.

Original code:

this.kvStore instanceof BaseInMemoryKVStore

Now:

this.kvStore instanceof SimpleKVStore

Copy link
Collaborator

Choose a reason for hiding this comment

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

@1997roylee good catch, i think we don't need this instanceof check at all - @himself65 can you have a look into this while working on #487 ?

Copy link
Member

Choose a reason for hiding this comment

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

yes I think instanceof is useless here. But it okay for now

Copy link
Author

Choose a reason for hiding this comment

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

should I close this PR? Or I can help to fix the persist issue of another class.

await this.persist(this.persistPath, this.fs); // Save the data after deleting the key
}

return true;
}
return false;
Expand Down