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

putSync returning Promise #235

Open
anywhichway opened this issue May 21, 2023 · 3 comments
Open

putSync returning Promise #235

anywhichway opened this issue May 21, 2023 · 3 comments

Comments

@anywhichway
Copy link

putSync is occasionally returning a Promise rather than a regular value. A review of the source shows the below at line 709 in write.js, so unless some other core code manages to force Promise resolution before returning, I can see how this would happen.

Is this expected? In the meantime, I am avoiding the use of putSync, which is relatively inconsequential.

putSync(key, value, versionOrOptions, ifVersion) {
			if (writeTxn)
				return this.put(key, value, versionOrOptions, ifVersion);
			else
				return this.transactionSync(() =>
					this.put(key, value, versionOrOptions, ifVersion) == SYNC_PROMISE_SUCCESS, overlappingSync? 0x10002 : 2); // non-abortable, async flush
		},
@kriszyp
Copy link
Owner

kriszyp commented May 21, 2023

Good catch, thank you.

@anywhichway
Copy link
Author

You are welcome. As I recall removeSync currently has a similar pattern in the write.js file.

Thanks for your prompt responses.

@anywhichway
Copy link
Author

kriszyp added a commit that referenced this issue Jun 12, 2023
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