]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
lmdbbackend/createDomain: reuse RW transaction
authorChris Hofstaedtler <chris.hofstaedtler@deduktiva.com>
Mon, 10 May 2021 15:29:42 +0000 (17:29 +0200)
committerChris Hofstaedtler <chris.hofstaedtler@deduktiva.com>
Sat, 15 May 2021 22:45:45 +0000 (00:45 +0200)
modules/lmdbbackend/lmdbbackend.cc

index 832beb667f5f6078a9eb8b92e7360f76652bbbaa..a28e1ee3c3863e836cfae053e94fac69ded2abc7 100644 (file)
@@ -969,12 +969,12 @@ bool LMDBBackend::createDomain(const DNSName& domain, const DomainInfo::DomainKi
     di.account = account;
 
     txn.put(di);
-    txn.commit();
-  }
 
-  if (zoneId != nullptr) {
-    auto txn = d_tdomains->getROTransaction();
-    *zoneId = txn.get<0>(domain, di);
+    if (zoneId != nullptr) {
+      *zoneId = txn.get<0>(domain, di);
+    }
+
+    txn.commit();
   }
 
   return true;