@nxtedition/rocksdb 12.0.3 → 12.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/chained-batch.js CHANGED
@@ -83,14 +83,18 @@ class ChainedBatch extends AbstractChainedBatch {
83
83
  }
84
84
 
85
85
  _close (callback) {
86
- assert(this[kBatchContext])
87
-
88
- binding.batch_clear(this[kBatchContext])
89
- this[kBatchContext] = null
86
+ this._closeSync()
90
87
 
91
88
  process.nextTick(callback)
92
89
  }
93
90
 
91
+ _closeSync () {
92
+ if (this[kBatchContext]) {
93
+ binding.batch_clear(this[kBatchContext])
94
+ this[kBatchContext] = null
95
+ }
96
+ }
97
+
94
98
  get length () {
95
99
  assert(this[kBatchContext])
96
100
 
package/iterator.js CHANGED
@@ -114,8 +114,6 @@ class Iterator extends AbstractIterator {
114
114
  }
115
115
 
116
116
  _close (callback) {
117
- assert(this[kContext])
118
-
119
117
  try {
120
118
  this._closeSync()
121
119
  process.nextTick(callback)
@@ -125,11 +123,12 @@ class Iterator extends AbstractIterator {
125
123
  }
126
124
 
127
125
  _closeSync () {
128
- assert(this[kContext])
129
-
130
126
  this[kCache] = kEmpty
131
- binding.iterator_close(this[kContext])
132
- this[kContext] = null
127
+
128
+ if (this[kContext]) {
129
+ binding.iterator_close(this[kContext])
130
+ this[kContext] = null
131
+ }
133
132
  }
134
133
 
135
134
  _end (callback) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/rocksdb",
3
- "version": "12.0.3",
3
+ "version": "12.0.4",
4
4
  "description": "A low-level Node.js RocksDB binding",
5
5
  "license": "MIT",
6
6
  "main": "index.js",