Skip to content

Commit

Permalink
Use internal write txn if available
Browse files Browse the repository at this point in the history
  • Loading branch information
kriszyp committed Nov 9, 2021
1 parent cb65a96 commit 1ee22b7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
1 change: 0 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ export function open(path, options) {
this.db = env.openDbi(Object.assign({
name: dbName,
create: true,
txn: env.writeTxn,
}, dbOptions));
this.db.name = dbName || null;
};
Expand Down
6 changes: 2 additions & 4 deletions src/dbi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,9 @@ NAN_METHOD(DbiWrap::ctor) {
Local<Value> hasVersionsLocal = options->Get(Nan::GetCurrentContext(), Nan::New<String>("useVersions").ToLocalChecked()).ToLocalChecked();
hasVersions = hasVersionsLocal->IsTrue();

auto txnObj = options->Get(Nan::GetCurrentContext(), Nan::New<String>("txn").ToLocalChecked()).ToLocalChecked();
if (!txnObj->IsNull() && !txnObj->IsUndefined() && txnObj->IsObject()) {
TxnWrap *tw = Nan::ObjectWrap::Unwrap<TxnWrap>(Local<Object>::Cast(txnObj));
if (ew->writeTxn) {
needsTransaction = false;
txn = tw->txn;
txn = ew->writeTxn->txn;
}
}
else {
Expand Down

0 comments on commit 1ee22b7

Please sign in to comment.