mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2025-01-14 04:01:56 +01:00
Fix deadlocks caused by waiting for async operations to complete before the scheduler has started
This commit is contained in:
parent
9b92143501
commit
77e70ef8d3
@ -183,11 +183,7 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
|
||||
|
||||
// Run update task to refresh any online users
|
||||
getLog().info("Scheduling Update Task to refresh any online users.");
|
||||
try {
|
||||
new UpdateTask(this).run();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
updateTaskBuffer.request();
|
||||
|
||||
registerPermissions(getConfiguration().isCommandsAllowOp() ? PermissionDefault.OP : PermissionDefault.FALSE);
|
||||
if (!getConfiguration().isOpsEnabled()) {
|
||||
|
@ -148,11 +148,7 @@ public class LPBungeePlugin extends Plugin implements LuckPermsPlugin {
|
||||
|
||||
// Run update task to refresh any online users
|
||||
getLog().info("Scheduling Update Task to refresh any online users.");
|
||||
try {
|
||||
new UpdateTask(this).run();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
updateTaskBuffer.request();
|
||||
|
||||
getLog().info("Successfully loaded.");
|
||||
}
|
||||
|
@ -83,11 +83,8 @@ public class AbstractDatastore implements Datastore {
|
||||
}
|
||||
|
||||
@Override
|
||||
public LPFuture<Void> init() {
|
||||
return makeFuture(() -> {
|
||||
backing.init();
|
||||
return null;
|
||||
});
|
||||
public void init() {
|
||||
backing.init();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -56,7 +56,7 @@ public interface Datastore {
|
||||
return this;
|
||||
}
|
||||
|
||||
LPFuture<Void> init();
|
||||
void init();
|
||||
LPFuture<Void> shutdown();
|
||||
LPFuture<Boolean> logAction(LogEntry entry);
|
||||
LPFuture<Log> getLog();
|
||||
|
@ -69,22 +69,16 @@ public class SplitBacking implements Datastore {
|
||||
}
|
||||
|
||||
@Override
|
||||
public LPFuture<Void> init() {
|
||||
AbstractFuture<Void> future = new AbstractFuture<>();
|
||||
doAsync(() -> {
|
||||
boolean success = true;
|
||||
backing.values().forEach(Datastore::init);
|
||||
for (Datastore ds : backing.values()) {
|
||||
if (!ds.isAcceptingLogins()) {
|
||||
success = false;
|
||||
}
|
||||
public void init() {
|
||||
boolean success = true;
|
||||
backing.values().forEach(Datastore::init);
|
||||
for (Datastore ds : backing.values()) {
|
||||
if (!ds.isAcceptingLogins()) {
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
|
||||
setAcceptingLogins(success);
|
||||
future.complete(null);
|
||||
});
|
||||
return future;
|
||||
|
||||
setAcceptingLogins(success);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -77,7 +77,7 @@ public class StorageFactory {
|
||||
}
|
||||
|
||||
plugin.getLog().info("Initialising datastore...");
|
||||
datastore.init().getOrDefault(null);
|
||||
datastore.init();
|
||||
return datastore;
|
||||
}
|
||||
|
||||
|
@ -75,13 +75,8 @@ public class TolerantDatastore implements Datastore {
|
||||
}
|
||||
|
||||
@Override
|
||||
public LPFuture<Void> init() {
|
||||
phaser.register();
|
||||
try {
|
||||
return backing.init();
|
||||
} finally {
|
||||
phaser.arriveAndDeregister();
|
||||
}
|
||||
public void init() {
|
||||
backing.init();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user