Use ops
This commit is contained in:
parent
e3abbd0bfa
commit
ccd84e729e
@ -173,6 +173,8 @@ public class EmbeddedDB implements RocksDBSyncAPI, InternalConnection, Closeable
|
||||
logger.debug("Cleaning expired transactions...");
|
||||
var idsToRemove = new LongArrayList();
|
||||
var startTime = System.currentTimeMillis();
|
||||
ops.beginOp();
|
||||
try {
|
||||
EmbeddedDB.this.txs.forEach(((txId, tx) -> {
|
||||
if (startTime >= tx.expirationTimestamp()) {
|
||||
idsToRemove.add((long) txId);
|
||||
@ -188,6 +190,9 @@ public class EmbeddedDB implements RocksDBSyncAPI, InternalConnection, Closeable
|
||||
}
|
||||
}
|
||||
});
|
||||
} finally {
|
||||
ops.endOp();
|
||||
}
|
||||
var endTime = System.currentTimeMillis();
|
||||
var removedCount = idsToRemove.size();
|
||||
if (removedCount > 2) {
|
||||
@ -202,6 +207,8 @@ public class EmbeddedDB implements RocksDBSyncAPI, InternalConnection, Closeable
|
||||
logger.debug("Cleaning expired iterators...");
|
||||
var idsToRemove = new LongArrayList();
|
||||
var startTime = System.currentTimeMillis();
|
||||
ops.beginOp();
|
||||
try {
|
||||
EmbeddedDB.this.its.forEach(((itId, entry) -> {
|
||||
if (entry.expirationTimestamp() != null && startTime >= entry.expirationTimestamp()) {
|
||||
idsToRemove.add((long) itId);
|
||||
@ -217,6 +224,9 @@ public class EmbeddedDB implements RocksDBSyncAPI, InternalConnection, Closeable
|
||||
}
|
||||
}
|
||||
});
|
||||
} finally {
|
||||
ops.endOp();
|
||||
}
|
||||
var endTime = System.currentTimeMillis();
|
||||
var removedCount = idsToRemove.size();
|
||||
if (removedCount > 2) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user