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

Skip writing empty (chained) batch and make callbacks asynchronous #619

Merged
merged 2 commits into from
Apr 26, 2019

Conversation

vweevers
Copy link
Member

While hunting for bugs (see thread in #601) I found that:

  1. The hasData_ property of chained batch is unused. Though LevelDB seems to be fine with writing an empty batch, this PR skips that if hasData_ is false, so that the behavior is symmetric with batch([]) (array-form) and with leveldown@4x.
  2. The callback of batch([]) (array-form) isn't asynchronous if the array is empty.

@vweevers vweevers added bug Something isn't working semver-patch Bug fixes that are backward compatible labels Apr 26, 2019
@vweevers

This comment has been minimized.

@vweevers
Copy link
Member Author

Canary-tested against Level/abstract-leveldown#337, all good.

@vweevers
Copy link
Member Author

vweevers commented Apr 26, 2019

Something for a rainy day: I think we can refactor chained and array-form batch to both use the Batch struct, and avoid the duplicate logic for hasData as well as the sync option.

=> #623

@vweevers vweevers merged commit e53ef55 into master Apr 26, 2019
@vweevers vweevers deleted the fix-empty-batch branch April 26, 2019 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working semver-patch Bug fixes that are backward compatible
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants