Skip to content
This repository has been archived by the owner on Dec 1, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
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