mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-28 05:35:26 +01:00
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.tasks.CacheHousekeepingTask;
|
||||
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.utils.LoginHelper;
|
||||
import me.lucko.luckperms.common.utils.UuidCache;
|
||||
@ -273,7 +274,7 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
|
||||
|
||||
// run an update instantly.
|
||||
getLog().info("Performing initial data load...");
|
||||
updateTaskBuffer.requestDirectly();
|
||||
new UpdateTask(this, true).run();
|
||||
|
||||
// register tasks
|
||||
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.tasks.CacheHousekeepingTask;
|
||||
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.utils.UuidCache;
|
||||
import me.lucko.luckperms.common.verbose.VerboseHandler;
|
||||
@ -200,7 +201,7 @@ public class LPBungeePlugin extends Plugin implements LuckPermsPlugin {
|
||||
|
||||
// run an update instantly.
|
||||
getLog().info("Performing initial data load...");
|
||||
updateTaskBuffer.requestDirectly();
|
||||
new UpdateTask(this, true).run();
|
||||
|
||||
// register tasks
|
||||
scheduler.asyncRepeating(new ExpireTemporaryTask(this), 60L);
|
||||
|
@ -38,7 +38,7 @@ public class UpdateTaskBuffer extends BufferedRequest<Void> {
|
||||
|
||||
@Override
|
||||
protected Void perform() {
|
||||
new UpdateTask(plugin).run();
|
||||
new UpdateTask(plugin, false).run();
|
||||
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.plugin.LuckPermsPlugin;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@AllArgsConstructor
|
||||
public class UpdateTask implements Runnable {
|
||||
private final LuckPermsPlugin plugin;
|
||||
|
||||
/**
|
||||
* If this task is being called before the server has fully started
|
||||
*/
|
||||
private final boolean initialUpdate;
|
||||
|
||||
/**
|
||||
* Called ASYNC
|
||||
*/
|
||||
@ -55,7 +62,10 @@ public class UpdateTask implements Runnable {
|
||||
plugin.getStorage().loadAllTracks().join();
|
||||
|
||||
// Refresh all online users.
|
||||
plugin.getUserManager().updateAllUsers().join();
|
||||
CompletableFuture<Void> userUpdateFut = plugin.getUserManager().updateAllUsers();
|
||||
if (!initialUpdate) {
|
||||
userUpdateFut.join();
|
||||
}
|
||||
|
||||
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.tasks.CacheHousekeepingTask;
|
||||
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.utils.UuidCache;
|
||||
import me.lucko.luckperms.common.verbose.VerboseHandler;
|
||||
@ -264,7 +265,7 @@ public class LPSpongePlugin implements LuckPermsPlugin {
|
||||
|
||||
// run an update instantly.
|
||||
getLog().info("Performing initial data load...");
|
||||
updateTaskBuffer.requestDirectly();
|
||||
new UpdateTask(this, true).run();
|
||||
|
||||
// register tasks
|
||||
scheduler.asyncRepeating(new ExpireTemporaryTask(this), 60L);
|
||||
|
Loading…
Reference in New Issue
Block a user