Ensure we flush iff it is needed

This commit is contained in:
Kenzie Togami 2018-10-20 19:54:13 -07:00
parent a3f1c71d97
commit d1312c66e1
No known key found for this signature in database
GPG Key ID: 5D200B325E157A81

View File

@ -415,7 +415,7 @@ public class EditSession implements Extent, AutoCloseable {
}
return;
}
if (!batchingChunks) {
if (!batchingChunks && isBatchingChunks()) {
flushSession();
}
chunkBatchingExtent.setEnabled(batchingChunks);
@ -428,9 +428,15 @@ public class EditSession implements Extent, AutoCloseable {
* @see #setBatchingChunks(boolean)
*/
public void disableBuffering() {
// We optimize here to avoid double calls to flushSession.
// We optimize here to avoid repeated calls to flushSession.
boolean needsFlush = isQueueEnabled() || isBatchingChunks();
if (needsFlush) {
flushSession();
}
reorderExtent.setEnabled(false);
setBatchingChunks(false);
if (chunkBatchingExtent != null) {
chunkBatchingExtent.setEnabled(false);
}
}
/**