Cleanup usages of loadUser/loadGroup/loadTrack - eliminate possibility for unloading race condition (#706)
This commit is contained in:
+2
-4
@@ -106,8 +106,7 @@ public class MigrationPermissionManager extends SubCommand<Object> {
|
||||
String pmName = MigrationUtils.standardizeName(pmGroup.getIdentifier());
|
||||
|
||||
// Make a LuckPerms group for the one being migrated
|
||||
plugin.getStorage().createAndLoadGroup(pmName, CreationCause.INTERNAL).join();
|
||||
Group group = plugin.getGroupManager().getIfLoaded(pmName);
|
||||
Group group = plugin.getStorage().createAndLoadGroup(pmName, CreationCause.INTERNAL).join();
|
||||
migrateSubject(pmGroup, group, 100);
|
||||
plugin.getStorage().saveGroup(group);
|
||||
|
||||
@@ -126,8 +125,7 @@ public class MigrationPermissionManager extends SubCommand<Object> {
|
||||
}
|
||||
|
||||
// Make a LuckPerms user for the one being migrated
|
||||
plugin.getStorage().loadUser(uuid, "null").join();
|
||||
User user = plugin.getUserManager().getIfLoaded(uuid);
|
||||
User user = plugin.getStorage().loadUser(uuid, "null").join();
|
||||
if (user.getEnduringNodes().size() <= 1) {
|
||||
user.clearNodes(false);
|
||||
}
|
||||
|
||||
+3
-6
@@ -131,8 +131,7 @@ public class MigrationPermissionsEx extends SubCommand<Object> {
|
||||
}
|
||||
|
||||
// Make a LuckPerms group for the one being migrated
|
||||
plugin.getStorage().createAndLoadGroup(pexName, CreationCause.INTERNAL).join();
|
||||
Group group = plugin.getGroupManager().getIfLoaded(pexName);
|
||||
Group group = plugin.getStorage().createAndLoadGroup(pexName, CreationCause.INTERNAL).join();
|
||||
migrateSubject(pexGroup, group, weight);
|
||||
plugin.getStorage().saveGroup(group);
|
||||
|
||||
@@ -153,8 +152,7 @@ public class MigrationPermissionsEx extends SubCommand<Object> {
|
||||
// Migrate tracks
|
||||
log.log("Starting track migration.");
|
||||
SafeIterator.iterate(tracks.entrySet(), e -> {
|
||||
plugin.getStorage().createAndLoadTrack(e.getKey(), CreationCause.INTERNAL).join();
|
||||
Track track = plugin.getTrackManager().getIfLoaded(e.getKey());
|
||||
Track track = plugin.getStorage().createAndLoadTrack(e.getKey(), CreationCause.INTERNAL).join();
|
||||
for (String groupName : e.getValue().values()) {
|
||||
Group group = plugin.getGroupManager().getIfLoaded(groupName);
|
||||
if (group != null) {
|
||||
@@ -179,8 +177,7 @@ public class MigrationPermissionsEx extends SubCommand<Object> {
|
||||
}
|
||||
|
||||
// Make a LuckPerms user for the one being migrated
|
||||
plugin.getStorage().loadUser(uuid, null).join();
|
||||
User user = plugin.getUserManager().getIfLoaded(uuid);
|
||||
User user = plugin.getStorage().loadUser(uuid, null).join();
|
||||
if (user.getEnduringNodes().size() <= 1) {
|
||||
user.clearNodes(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user