Skip to content

Commit f8e9b32

Browse files
committed
fix: trial synchronising SQLManager#sendBatch
- I don't think this is likely to cause any issues; I don't see any reason for deadlocks/excessive waits here - attempts to address #4612 - this is the only reason I can find that there would be some kind of race condition that sets auto commit whilst attempting to commit from the main thread and would also explain why we get the NoSuchElementException in the above issue as well
1 parent 8edc5c1 commit f8e9b32

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

Core/src/main/java/com/plotsquared/core/database/SQLManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ public synchronized void addNotifyTask(Runnable task) {
389389
}
390390
}
391391

392-
public boolean sendBatch() {
392+
public synchronized boolean sendBatch() {
393393
try {
394394
if (!getGlobalTasks().isEmpty()) {
395395
if (this.connection.getAutoCommit()) {

Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,7 @@ public int getPlotCount(String world) {
391391
int count = 0;
392392
for (PlotArea area : this.plotAreaManager.getPlotAreasSet(world)) {
393393
if (!Settings.Done.COUNTS_TOWARDS_LIMIT) {
394-
count +=
395-
area.getPlotsAbs(uuid).stream().filter(plot -> !DoneFlag.isDone(plot)).count();
394+
count += area.getPlotsAbs(uuid).stream().filter(plot -> !DoneFlag.isDone(plot)).count();
396395
} else {
397396
count += area.getPlotsAbs(uuid).size();
398397
}

0 commit comments

Comments
 (0)