Slight speed improvement for import processes
This commit is contained in:
+18
-3
@@ -167,7 +167,12 @@ public abstract class SubCommand<T> extends Command<T, Void> {
|
||||
|
||||
public static void save(User user, Sender sender, LuckPermsPlugin plugin) {
|
||||
boolean success = plugin.getStorage().force().saveUser(user).join();
|
||||
user.getRefreshBuffer().requestDirectly();
|
||||
|
||||
if (sender.isImport()) {
|
||||
user.getRefreshBuffer().request();
|
||||
} else {
|
||||
user.getRefreshBuffer().requestDirectly();
|
||||
}
|
||||
|
||||
if (success) {
|
||||
Message.USER_SAVE_SUCCESS.send(sender);
|
||||
@@ -178,7 +183,12 @@ public abstract class SubCommand<T> extends Command<T, Void> {
|
||||
|
||||
public static void save(Group group, Sender sender, LuckPermsPlugin plugin) {
|
||||
boolean success = plugin.getStorage().force().saveGroup(group).join();
|
||||
plugin.getUpdateTaskBuffer().requestDirectly();
|
||||
|
||||
if (sender.isImport()) {
|
||||
plugin.getUpdateTaskBuffer().request();
|
||||
} else {
|
||||
plugin.getUpdateTaskBuffer().requestDirectly();
|
||||
}
|
||||
|
||||
if (success) {
|
||||
Message.GROUP_SAVE_SUCCESS.send(sender);
|
||||
@@ -189,7 +199,12 @@ public abstract class SubCommand<T> extends Command<T, Void> {
|
||||
|
||||
public static void save(Track track, Sender sender, LuckPermsPlugin plugin) {
|
||||
boolean success = plugin.getStorage().force().saveTrack(track).join();
|
||||
plugin.getUpdateTaskBuffer().requestDirectly();
|
||||
|
||||
if (sender.isImport()) {
|
||||
plugin.getUpdateTaskBuffer().request();
|
||||
} else {
|
||||
plugin.getUpdateTaskBuffer().requestDirectly();
|
||||
}
|
||||
|
||||
if (success) {
|
||||
Message.TRACK_SAVE_SUCCESS.send(sender);
|
||||
|
||||
@@ -93,4 +93,9 @@ public class AbstractSender<T> implements Sender {
|
||||
return this.uuid.equals(Constants.CONSOLE_UUID) || this.uuid.equals(Constants.IMPORT_UUID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isImport() {
|
||||
return this.uuid.equals(Constants.IMPORT_UUID);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -85,4 +85,11 @@ public interface Sender {
|
||||
*/
|
||||
boolean isConsole();
|
||||
|
||||
/**
|
||||
* Gets whether this sender is an import process
|
||||
*
|
||||
* @return if the sender is an import process
|
||||
*/
|
||||
boolean isImport();
|
||||
|
||||
}
|
||||
|
||||
@@ -101,6 +101,10 @@ public class PriorityComparator implements Comparator<LocalizedNode> {
|
||||
}
|
||||
|
||||
public int compareStrings(String o1, String o2) {
|
||||
if (o1.equals(o2)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
try {
|
||||
CollationKey o1c = collationKeyCache.get(o1);
|
||||
CollationKey o2c = collationKeyCache.get(o2);
|
||||
|
||||
@@ -213,6 +213,11 @@ public class Importer implements Runnable {
|
||||
public boolean isConsole() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isImport() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Getter
|
||||
|
||||
Reference in New Issue
Block a user