Skip to content

Commit

Permalink
Ensure we flush iff it is needed
Browse files Browse the repository at this point in the history
  • Loading branch information
octylFractal committed Oct 21, 2018
1 parent a3f1c71 commit d1312c6
Showing 1 changed file with 9 additions and 3 deletions.
Expand Up @@ -415,7 +415,7 @@ public void setBatchingChunks(boolean batchingChunks) {
}
return;
}
if (!batchingChunks) {
if (!batchingChunks && isBatchingChunks()) {
flushSession();
}
chunkBatchingExtent.setEnabled(batchingChunks);
Expand All @@ -428,9 +428,15 @@ public void setBatchingChunks(boolean batchingChunks) {
* @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);
}
}

/**
Expand Down

0 comments on commit d1312c6

Please sign in to comment.