Fix startup deadlock
This commit is contained in:
parent
2412edaa3a
commit
67602b8d85
@ -76,6 +76,7 @@ import me.lucko.luckperms.common.storage.StorageType;
|
|||||||
import me.lucko.luckperms.common.storage.backing.file.FileWatcher;
|
import me.lucko.luckperms.common.storage.backing.file.FileWatcher;
|
||||||
import me.lucko.luckperms.common.tasks.CacheHousekeepingTask;
|
import me.lucko.luckperms.common.tasks.CacheHousekeepingTask;
|
||||||
import me.lucko.luckperms.common.tasks.ExpireTemporaryTask;
|
import me.lucko.luckperms.common.tasks.ExpireTemporaryTask;
|
||||||
|
import me.lucko.luckperms.common.tasks.UpdateTask;
|
||||||
import me.lucko.luckperms.common.treeview.PermissionVault;
|
import me.lucko.luckperms.common.treeview.PermissionVault;
|
||||||
import me.lucko.luckperms.common.utils.LoginHelper;
|
import me.lucko.luckperms.common.utils.LoginHelper;
|
||||||
import me.lucko.luckperms.common.utils.UuidCache;
|
import me.lucko.luckperms.common.utils.UuidCache;
|
||||||
@ -273,7 +274,7 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
|
|||||||
|
|
||||||
// run an update instantly.
|
// run an update instantly.
|
||||||
getLog().info("Performing initial data load...");
|
getLog().info("Performing initial data load...");
|
||||||
updateTaskBuffer.requestDirectly();
|
new UpdateTask(this, true).run();
|
||||||
|
|
||||||
// register tasks
|
// register tasks
|
||||||
scheduler.asyncRepeating(new ExpireTemporaryTask(this), 60L);
|
scheduler.asyncRepeating(new ExpireTemporaryTask(this), 60L);
|
||||||
|
@ -72,6 +72,7 @@ import me.lucko.luckperms.common.storage.StorageType;
|
|||||||
import me.lucko.luckperms.common.storage.backing.file.FileWatcher;
|
import me.lucko.luckperms.common.storage.backing.file.FileWatcher;
|
||||||
import me.lucko.luckperms.common.tasks.CacheHousekeepingTask;
|
import me.lucko.luckperms.common.tasks.CacheHousekeepingTask;
|
||||||
import me.lucko.luckperms.common.tasks.ExpireTemporaryTask;
|
import me.lucko.luckperms.common.tasks.ExpireTemporaryTask;
|
||||||
|
import me.lucko.luckperms.common.tasks.UpdateTask;
|
||||||
import me.lucko.luckperms.common.treeview.PermissionVault;
|
import me.lucko.luckperms.common.treeview.PermissionVault;
|
||||||
import me.lucko.luckperms.common.utils.UuidCache;
|
import me.lucko.luckperms.common.utils.UuidCache;
|
||||||
import me.lucko.luckperms.common.verbose.VerboseHandler;
|
import me.lucko.luckperms.common.verbose.VerboseHandler;
|
||||||
@ -200,7 +201,7 @@ public class LPBungeePlugin extends Plugin implements LuckPermsPlugin {
|
|||||||
|
|
||||||
// run an update instantly.
|
// run an update instantly.
|
||||||
getLog().info("Performing initial data load...");
|
getLog().info("Performing initial data load...");
|
||||||
updateTaskBuffer.requestDirectly();
|
new UpdateTask(this, true).run();
|
||||||
|
|
||||||
// register tasks
|
// register tasks
|
||||||
scheduler.asyncRepeating(new ExpireTemporaryTask(this), 60L);
|
scheduler.asyncRepeating(new ExpireTemporaryTask(this), 60L);
|
||||||
|
@ -38,7 +38,7 @@ public class UpdateTaskBuffer extends BufferedRequest<Void> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Void perform() {
|
protected Void perform() {
|
||||||
new UpdateTask(plugin).run();
|
new UpdateTask(plugin, false).run();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,10 +31,17 @@ import me.lucko.luckperms.api.event.cause.CreationCause;
|
|||||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||||
|
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class UpdateTask implements Runnable {
|
public class UpdateTask implements Runnable {
|
||||||
private final LuckPermsPlugin plugin;
|
private final LuckPermsPlugin plugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If this task is being called before the server has fully started
|
||||||
|
*/
|
||||||
|
private final boolean initialUpdate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called ASYNC
|
* Called ASYNC
|
||||||
*/
|
*/
|
||||||
@ -55,7 +62,10 @@ public class UpdateTask implements Runnable {
|
|||||||
plugin.getStorage().loadAllTracks().join();
|
plugin.getStorage().loadAllTracks().join();
|
||||||
|
|
||||||
// Refresh all online users.
|
// Refresh all online users.
|
||||||
plugin.getUserManager().updateAllUsers().join();
|
CompletableFuture<Void> userUpdateFut = plugin.getUserManager().updateAllUsers();
|
||||||
|
if (!initialUpdate) {
|
||||||
|
userUpdateFut.join();
|
||||||
|
}
|
||||||
|
|
||||||
plugin.onPostUpdate();
|
plugin.onPostUpdate();
|
||||||
|
|
||||||
|
@ -65,6 +65,7 @@ import me.lucko.luckperms.common.storage.StorageType;
|
|||||||
import me.lucko.luckperms.common.storage.backing.file.FileWatcher;
|
import me.lucko.luckperms.common.storage.backing.file.FileWatcher;
|
||||||
import me.lucko.luckperms.common.tasks.CacheHousekeepingTask;
|
import me.lucko.luckperms.common.tasks.CacheHousekeepingTask;
|
||||||
import me.lucko.luckperms.common.tasks.ExpireTemporaryTask;
|
import me.lucko.luckperms.common.tasks.ExpireTemporaryTask;
|
||||||
|
import me.lucko.luckperms.common.tasks.UpdateTask;
|
||||||
import me.lucko.luckperms.common.treeview.PermissionVault;
|
import me.lucko.luckperms.common.treeview.PermissionVault;
|
||||||
import me.lucko.luckperms.common.utils.UuidCache;
|
import me.lucko.luckperms.common.utils.UuidCache;
|
||||||
import me.lucko.luckperms.common.verbose.VerboseHandler;
|
import me.lucko.luckperms.common.verbose.VerboseHandler;
|
||||||
@ -264,7 +265,7 @@ public class LPSpongePlugin implements LuckPermsPlugin {
|
|||||||
|
|
||||||
// run an update instantly.
|
// run an update instantly.
|
||||||
getLog().info("Performing initial data load...");
|
getLog().info("Performing initial data load...");
|
||||||
updateTaskBuffer.requestDirectly();
|
new UpdateTask(this, true).run();
|
||||||
|
|
||||||
// register tasks
|
// register tasks
|
||||||
scheduler.asyncRepeating(new ExpireTemporaryTask(this), 60L);
|
scheduler.asyncRepeating(new ExpireTemporaryTask(this), 60L);
|
||||||
|
Loading…
Reference in New Issue
Block a user