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

Change Store.save() to return a Promise #3221

Merged
merged 2 commits into from
Apr 11, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export interface IStore {
/**
* Save does nothing as there is no backing data store.
*/
save(force?: boolean): void;
save(force?: boolean): Promise<void>;

/**
* Startup does nothing.
Expand Down
4 changes: 3 additions & 1 deletion src/store/memory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,9 @@ export class MemoryStore implements IStore {
* @param force - True to force a save (but the memory
* store still can't save anything)
*/
public save(force: boolean): void {}
public save(force: boolean): Promise<void> {
return Promise.resolve();
}

/**
* Startup does nothing as this store doesn't require starting up.
Expand Down
4 changes: 3 additions & 1 deletion src/store/stub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,9 @@ export class StubStore implements IStore {
/**
* Save does nothing as there is no backing data store.
*/
public save(): void {}
public save(): Promise<void> {
return Promise.resolve();
}

/**
* Startup does nothing.
Expand Down
2 changes: 1 addition & 1 deletion src/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,7 @@ export class SyncApi {
}

// tell databases that everything is now in a consistent state and can be saved.
this.client.store.save();
await this.client.store.save();
}
}

Expand Down